aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/ctx.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r--editors/code/src/ctx.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index aa75943bf..70042a479 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -11,6 +11,9 @@ export class Ctx {
11 // deal with it. 11 // deal with it.
12 // 12 //
13 // Ideally, this should be replaced with async getter though. 13 // Ideally, this should be replaced with async getter though.
14 // FIXME: this actually needs syncronization of some kind (check how
15 // vscode deals with `deactivate()` call when extension has some work scheduled
16 // on the event loop to get a better picture of what we can do here)
14 client: lc.LanguageClient | null = null; 17 client: lc.LanguageClient | null = null;
15 private extCtx: vscode.ExtensionContext; 18 private extCtx: vscode.ExtensionContext;
16 private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = []; 19 private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = [];
@@ -26,7 +29,14 @@ export class Ctx {
26 await old.stop(); 29 await old.stop();
27 } 30 }
28 this.client = null; 31 this.client = null;
29 const client = createClient(this.config); 32 const client = await createClient(this.config);
33 if (!client) {
34 throw new Error(
35 "Rust Analyzer Language Server is not available. " +
36 "Please, ensure its [proper installation](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#vs-code)."
37 );
38 }
39
30 this.pushCleanup(client.start()); 40 this.pushCleanup(client.start());
31 await client.onReady(); 41 await client.onReady();
32 42