diff options
Diffstat (limited to 'editors/code/src/server.ts')
-rw-r--r-- | editors/code/src/server.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index 7907b70bc..e717ab294 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { lookpath } from 'lookpath'; | ||
1 | import { homedir } from 'os'; | 2 | import { homedir } from 'os'; |
2 | import * as lc from 'vscode-languageclient'; | 3 | import * as lc from 'vscode-languageclient'; |
3 | 4 | ||
@@ -17,7 +18,7 @@ export class Server { | |||
17 | public static config = new Config(); | 18 | public static config = new Config(); |
18 | public static client: lc.LanguageClient; | 19 | public static client: lc.LanguageClient; |
19 | 20 | ||
20 | public static start( | 21 | public static async start( |
21 | notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> | 22 | notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> |
22 | ) { | 23 | ) { |
23 | // '.' Is the fallback if no folder is open | 24 | // '.' Is the fallback if no folder is open |
@@ -27,8 +28,14 @@ export class Server { | |||
27 | folder = workspace.workspaceFolders[0].uri.fsPath.toString(); | 28 | folder = workspace.workspaceFolders[0].uri.fsPath.toString(); |
28 | } | 29 | } |
29 | 30 | ||
31 | const command = expandPathResolving(this.config.raLspServerPath); | ||
32 | if (!(await lookpath(command))) { | ||
33 | throw new Error( | ||
34 | `Cannot find rust-analyzer server \`${command}\` in PATH.` | ||
35 | ); | ||
36 | } | ||
30 | const run: lc.Executable = { | 37 | const run: lc.Executable = { |
31 | command: expandPathResolving(this.config.raLspServerPath), | 38 | command, |
32 | options: { cwd: folder } | 39 | options: { cwd: folder } |
33 | }; | 40 | }; |
34 | const serverOptions: lc.ServerOptions = { | 41 | const serverOptions: lc.ServerOptions = { |