aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r--editors/code/src/main.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 0bf2c4829..ece4883bd 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -5,18 +5,27 @@ import { activateInlayHints } from './inlay_hints';
5import { activateStatusDisplay } from './status_display'; 5import { activateStatusDisplay } from './status_display';
6import { Ctx } from './ctx'; 6import { Ctx } from './ctx';
7import { activateHighlighting } from './highlighting'; 7import { activateHighlighting } from './highlighting';
8import { ensureServerBinary } from './installation/server';
8 9
9let ctx: Ctx | undefined; 10let ctx: Ctx | undefined;
10 11
11export async function activate(context: vscode.ExtensionContext) { 12export async function activate(context: vscode.ExtensionContext) {
12 ctx = new Ctx(context); 13 ctx = new Ctx(context);
13 14
15 const serverPath = await ensureServerBinary(ctx.config.serverSource);
16 if (serverPath == null) {
17 throw new Error(
18 "Rust Analyzer Language Server is not available. " +
19 "Please, ensure its [proper installation](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#vs-code)."
20 );
21 }
22
14 // Note: we try to start the server before we activate type hints so that it 23 // Note: we try to start the server before we activate type hints so that it
15 // registers its `onDidChangeDocument` handler before us. 24 // registers its `onDidChangeDocument` handler before us.
16 // 25 //
17 // This a horribly, horribly wrong way to deal with this problem. 26 // This a horribly, horribly wrong way to deal with this problem.
18 try { 27 try {
19 await ctx.startServer(); 28 await ctx.startServer(serverPath);
20 } catch (e) { 29 } catch (e) {
21 vscode.window.showErrorMessage(e.message); 30 vscode.window.showErrorMessage(e.message);
22 } 31 }