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, 4 insertions, 7 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 947d5eb90..0ad7ef1bb 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -6,13 +6,14 @@ import { 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'; 8import { ensureServerBinary } from './installation/server';
9import { Config } from './config';
9 10
10let ctx: Ctx | undefined; 11let ctx: Ctx | undefined;
11 12
12export async function activate(context: vscode.ExtensionContext) { 13export async function activate(context: vscode.ExtensionContext) {
13 ctx = new Ctx(context); 14 const config = new Config(context)
14 15
15 const serverPath = await ensureServerBinary(ctx.config.serverSource); 16 const serverPath = await ensureServerBinary(config.serverSource);
16 if (serverPath == null) { 17 if (serverPath == null) {
17 throw new Error( 18 throw new Error(
18 "Rust Analyzer Language Server is not available. " + 19 "Rust Analyzer Language Server is not available. " +
@@ -24,11 +25,7 @@ export async function activate(context: vscode.ExtensionContext) {
24 // registers its `onDidChangeDocument` handler before us. 25 // registers its `onDidChangeDocument` handler before us.
25 // 26 //
26 // This a horribly, horribly wrong way to deal with this problem. 27 // This a horribly, horribly wrong way to deal with this problem.
27 try { 28 ctx = await Ctx.create(config, context, serverPath);
28 await ctx.startServer(serverPath);
29 } catch (e) {
30 vscode.window.showErrorMessage(e.message);
31 }
32 29
33 // Commands which invokes manually via command palette, shortcut, etc. 30 // Commands which invokes manually via command palette, shortcut, etc.
34 ctx.registerCommand('reload', (ctx) => { 31 ctx.registerCommand('reload', (ctx) => {