VS Code: Add customBinaryPath option #3386
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This option allows to provide any compatible binary to be used as
ruby-lsp
exec. This is especially useful for containerized development with VS Code running on the host machine (i.e., not using Dev Containers or Remote Containers). A typical use case is the applications usingdip
(and ruby-on-whales) (see #2919). However, the ability to customize the binary path has many more potential applications.Motivation continues...
I've been using a similar approach with Zed for a while (it already provides this option). The trick is to use a thin Bash wrapper to run
ruby-lsp
anywhere. Mine looks as follows:That's it.
With this change, we can configure
rubyLsp.customBinaryPath
to point to a custom executable (say, ".dockerdev/ruby-lsp"), and benefit from LSP features even without having Ruby LSP (and even Ruby) installed locally (let me omit some Docker-specific tricks used to make it work, not relevant to the proposal).Implementation
package.json
:customBinaryPath
client.ts
to use the new option if present to generate commands configuration.Automated Tests
None. Couldn't find any tests for similar functionality (commands configuration). Would love to have some guidance here.
Manual Tests
Packaged and installed the forked version locally and verified that LSP works.