From 7bd9c3b2281dc270d9cc3c465d669a6073f57825 Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Sat, 19 Oct 2024 11:16:14 -0400 Subject: [PATCH] Add setting to control usage of launcher --- vscode/package.json | 5 +++++ vscode/src/client.ts | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/vscode/package.json b/vscode/package.json index 6ef12643a..afc141465 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -473,6 +473,11 @@ "description": "Enable ERB support. This can only work with server versions v0.17.5 or above", "type": "boolean", "default": true + }, + "rubyLsp.useLauncher": { + "description": "[EXPERIMENTAL] Uses server launcher for gracefully handling missing dependencies.", + "type": "boolean", + "default": false } } }, diff --git a/vscode/src/client.ts b/vscode/src/client.ts index 9def4acea..f5cb7ff03 100644 --- a/vscode/src/client.ts +++ b/vscode/src/client.ts @@ -62,6 +62,7 @@ function getLspExecutables( const customBundleGemfile: string = config.get("bundleGemfile")!; const useBundlerCompose: boolean = config.get("useBundlerCompose")!; const bypassTypechecker: boolean = config.get("bypassTypechecker")!; + const useLauncher: boolean = config.get("useLauncher")!; const executableOptions: ExecutableOptions = { cwd: workspaceFolder.uri.fsPath, @@ -98,17 +99,25 @@ function getLspExecutables( options: executableOptions, }; } else { - const argsWithBranch = branch.length > 0 ? ["--branch", branch] : []; + const args = []; + + if (branch.length > 0) { + args.push("--branch", branch); + } + + if (useLauncher) { + args.push("--use-launcher"); + } run = { command: "ruby-lsp", - args: argsWithBranch, + args, options: executableOptions, }; debug = { command: "ruby-lsp", - args: argsWithBranch.concat(["--debug"]), + args: args.concat(["--debug"]), options: executableOptions, }; }