aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/client.ts')
-rw-r--r--editors/code/src/client.ts29
1 files changed, 12 insertions, 17 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index 1778c4e9f..7e7e909dd 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -7,25 +7,21 @@ import { Config } from './config';
7 7
8export function createClient(config: Config): lc.LanguageClient { 8export function createClient(config: Config): lc.LanguageClient {
9 // '.' Is the fallback if no folder is open 9 // '.' Is the fallback if no folder is open
10 // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. 10 // TODO?: Workspace folders support Uri's (eg: file://test.txt).
11 let folder: string = '.'; 11 // It might be a good idea to test if the uri points to a file.
12 if (workspace.workspaceFolders !== undefined) { 12 const workspaceFolderPath = workspace.workspaceFolders?.[0]?.uri.fsPath ?? '.';
13 folder = workspace.workspaceFolders[0].uri.fsPath.toString();
14 }
15 13
16 const command = expandPathResolving(config.raLspServerPath); 14 const raLspServerPath = expandPathResolving(config.raLspServerPath);
17 if (spawnSync(command, ["--version"]).status !== 0) { 15 if (spawnSync(raLspServerPath, ["--version"]).status !== 0) {
18 window.showErrorMessage( 16 window.showErrorMessage(
19 `Unable to execute '${command} --version' 17 `Unable to execute '${raLspServerPath} --version'\n\n` +
20 18 `Perhaps it is not in $PATH?\n\n` +
21Perhaps it is not in $PATH? 19 `PATH=${process.env.PATH}\n`
22 20 );
23PATH=${process.env.PATH}
24`);
25 } 21 }
26 const run: lc.Executable = { 22 const run: lc.Executable = {
27 command, 23 command: raLspServerPath,
28 options: { cwd: folder }, 24 options: { cwd: workspaceFolderPath },
29 }; 25 };
30 const serverOptions: lc.ServerOptions = { 26 const serverOptions: lc.ServerOptions = {
31 run, 27 run,
@@ -43,8 +39,7 @@ PATH=${process.env.PATH}
43 cargoWatchEnable: config.cargoWatchOptions.enable, 39 cargoWatchEnable: config.cargoWatchOptions.enable,
44 cargoWatchArgs: config.cargoWatchOptions.arguments, 40 cargoWatchArgs: config.cargoWatchOptions.arguments,
45 cargoWatchCommand: config.cargoWatchOptions.command, 41 cargoWatchCommand: config.cargoWatchOptions.command,
46 cargoWatchAllTargets: 42 cargoWatchAllTargets: config.cargoWatchOptions.allTargets,
47 config.cargoWatchOptions.allTargets,
48 excludeGlobs: config.excludeGlobs, 43 excludeGlobs: config.excludeGlobs,
49 useClientWatching: config.useClientWatching, 44 useClientWatching: config.useClientWatching,
50 featureFlags: config.featureFlags, 45 featureFlags: config.featureFlags,