diff --git a/vscode/package.json b/vscode/package.json index 337252655..8fd4ad367 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -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", diff --git a/vscode/src/client.ts b/vscode/src/client.ts index 260d7fe19..f1b8b73f9 100644 --- a/vscode/src/client.ts +++ b/vscode/src/client.ts @@ -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")!; @@ -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"],