-
I haven't found a straightforward way to run my local ruby-lsp server in standalone mode for debugging. I'm wondering how others are approaching development in similar scenarios, if there is a more direct approach that I have missed and otherwise if support could be added for this. In the meantime, I've found a workaround that might be helpful to others facing the same issue. I'm sharing it here in case it assists someone, and I'd also appreciate any insights or alternative solutions. The IssueMy launch config for debugging the extension opens another (Gemfile-less) workspace: "args": [
"/path/to/target/workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--disable-extensions"
], The target workspace does not have a Gemfile and the path does not end in ruby-lsp, so getLspExecutables resolves to just ruby-lsp which loads my installed gem instead of my local repo. I was able to get the workspace to load my local copy if I set a custom Gemfile that has The WorkaroundFor now, I added a ruby-lsp symlink in my target workspace that points to my local exe/ruby-lsp. This works! I had cursor create tasks to link and unlink automatically. launch.json "preLaunchTask": "create-ruby-lsp-symlink",
"postDebugTask": "remove-ruby-lsp-symlink" tasks.json {
"label": "create-ruby-lsp-symlink",
"type": "shell",
"command": "ln",
"args": [
"-s",
"/path/to/ruby-lsp/exe/ruby-lsp",
"/path/to/target/workspace/ruby-lsp"
],
"group": "build",
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": []
},
{
"label": "remove-ruby-lsp-symlink",
"type": "shell",
"command": "rm",
"args": [
"-f",
"path/to/target/workspace/ruby-lsp"
],
"group": "build",
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": []
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Honestly, I haven't found a good solution for this yet, so we'll take any ideas. What I normally do, especially when investigating a bug, is this:
It's definitely not the most straight forward thing. We do have a It would require some changes though as the Gemfile we generate in gem "ruby-lsp", github: "Shopify/ruby-lsp", branch: the_branch
# vs
gem "ruby-lsp", path: "/path/to/local/copy" |
Beta Was this translation helpful? Give feedback.
-
Yes, I'd like the option to configure the path to the server, so I can easily run my local changes in any workspace. I think it should be a separate configuration setting, as they are conceptually different. It also may not be straightforward to determine whether a branch or file path was intended since branches can contain slashes. My preferred solution would involve something temporary that I could set in the launch configuration, but I don't think VS Code supports this. |
Beta Was this translation helpful? Give feedback.
Honestly, I haven't found a good solution for this yet, so we'll take any ideas. What I normally do, especially when investigating a bug, is this:
Debug the Ruby LSP server
It's definitely not the most straight forward thing. We do have a
rubyLsp.branch
setting, which allows you to use a version of the LSP that exists on GitHub. Maybe we can make that setting accept a file path as well and then you can point to your local copy even without a bundle. What do you think?I…