Open Nowaker opened 6 months ago
Thank you for the feature suggestion! Looks like the debug
server has support for this, so it's a matter of the extension supporting the configuration and passing that to the server.
I believe that reading those configurations and passing it as a command line argument to the debug server here is probably going to be enough.
This feature is VS Code specific
Use case
The goal is to be able to debug a Ruby process that is run on a different machine than the current one.
Description
To do that, there must be a mechanism to translate server paths to local paths.
ssh -L /tmp/ruby-lsp-debug-sockets/ruby-debug-worldmodern-0.sock:/tmp/ruby.sock user@server
bundle exec rdbg --open --command --sock-path=/tmp/ruby.sock -- puma
request=attach
) as if it's a local server.This works. However, no breakpoint will trip because breakpoints are set as
/home/nowaker/projects/worldmodern/app/controllers/whatever_controller.rb:123
but the server sees it as/var/www/worldmodern/app/controllers/whatever_controller.rb:123
.We need a way to define path mappings, similar to how other VS Code debuggers support it (see PHP):
Mappings for project directory and gem directory are a must-have to make it work.
NOTE: Debugging as such works. Nothing needs fixing here. I can pause (F6) and I'll see wherever Puma was processing a request. I can them step over, continue, etc no problem.
It's just the path mapping that needs to be provided to visually set up breakpoints locally, and make them trip on the server.
Implementation