ruby-lsp icon indicating copy to clipboard operation
ruby-lsp copied to clipboard

Attach to debug session by port number instead of socket

Open gregawoods opened this issue 2 years ago • 2 comments

This feature is VS Code specific

  • [X] VS Code specific

Use case

It would be useful to be able to connect to a debug session by port number rather than by socket. This is particularly nice when the debug server is running inside of a docker container.

Description

The way that we debug our ruby apps today is to start a debug session inside of the development docker container and expose it via a custom port number. For example, the rails server is started with a command like this:

bin/rdbg -O -n -c --port=12345 --host=0.0.0.0 -- bin/rails server

The port is exposed to the host machine via docker compose, and then we can connect to it through vscode using the vscode-rdbg extension. A working config looks something like this:

{
  "type": "rdbg",
  "name": "Attach with rdbg",
  "request": "attach",
  "debugPort": "12345",
  "localfsMap": "/api:${workspaceFolder}"
}

Additionally, the localfsMap key allows us to specify how file paths within the container correlate to file paths on the host machine.

I wonder if vscode-ruby-lsp would be interested in supporting such a setup. Of course, we can continue using vscode-rdbg in the interim.

Implementation

No response

gregawoods avatar Sep 14 '23 18:09 gregawoods

It's definitely a valid use case that we'd want to support in the client. However, we may not be able to prioritize this immediately - in case anyone wants to contribute that.

vinistock avatar Sep 15 '23 12:09 vinistock

This issue is being marked as stale because there was no activity in the last 2 months

github-actions[bot] avatar Nov 15 '23 12:11 github-actions[bot]