Skip to content

VS Code: Add customBinaryPath option #3386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@
"description": "A shell command to activate the right Ruby version or add a custom Ruby bin folder to the PATH. Only used if rubyVersionManager is set to 'custom'",
"type": "string"
},
"rubyLsp.customBinaryPath": {
"description": "A path to a custom Ruby LSP binary executable",
"type": "string"
},
"rubyLsp.formatter": {
"description": "Which tool the Ruby LSP should use for formatting files",
"type": "string",
Expand Down
17 changes: 16 additions & 1 deletion vscode/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function getLspExecutables(
const config = vscode.workspace.getConfiguration("rubyLsp");
const branch: string = config.get("branch")!;
const customBundleGemfile: string = config.get("bundleGemfile")!;
const customBinPath: string = config.get("customBinaryPath")!;
const useBundlerCompose: boolean = config.get("useBundlerCompose")!;
const bypassTypechecker: boolean = config.get("bypassTypechecker")!;

Expand All @@ -110,9 +111,23 @@ function getLspExecutables(
shell: true,
};

// If there's a user defined custom binary path, run it and just trust that it is `ruby-lsp` compatible.
if (customBinPath) {
run = {
command: customBinPath,
args: [],
options: executableOptions,
};

debug = {
command: customBinPath,
args: ["--debug"],
options: executableOptions,
};
}
// If there's a user defined custom bundle, we run the LSP with `bundle exec` and just trust the user configured
// their bundle. Otherwise, we run the global install of the LSP and use our composed bundle logic in the server
if (customBundleGemfile.length > 0) {
else if (customBundleGemfile.length > 0) {
run = {
command: "bundle",
args: ["exec", "ruby-lsp"],
Expand Down