diff options
author | Aleksey Kladov <[email protected]> | 2020-02-17 12:40:20 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-02-17 12:40:47 +0000 |
commit | d24e612106867c4bb6a1e59bf99aabfb7bc27823 (patch) | |
tree | df40b6265f303b8fba5f804a7f7ff370e844dea0 /editors/code/src/main.ts | |
parent | dcdbbddd1630a4ed01906c2aff0e2b65ed99a591 (diff) |
Simplify startup
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r-- | editors/code/src/main.ts | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index ec488c340..0bf2c4829 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -11,6 +11,17 @@ let ctx: Ctx | undefined; | |||
11 | export async function activate(context: vscode.ExtensionContext) { | 11 | export async function activate(context: vscode.ExtensionContext) { |
12 | ctx = new Ctx(context); | 12 | ctx = new Ctx(context); |
13 | 13 | ||
14 | // Note: we try to start the server before we activate type hints so that it | ||
15 | // registers its `onDidChangeDocument` handler before us. | ||
16 | // | ||
17 | // This a horribly, horribly wrong way to deal with this problem. | ||
18 | try { | ||
19 | await ctx.startServer(); | ||
20 | } catch (e) { | ||
21 | vscode.window.showErrorMessage(e.message); | ||
22 | } | ||
23 | |||
24 | // Commands which invokes manually via command palette, shortcut, etc. | ||
14 | ctx.registerCommand('reload', (ctx) => { | 25 | ctx.registerCommand('reload', (ctx) => { |
15 | return async () => { | 26 | return async () => { |
16 | vscode.window.showInformationMessage('Reloading rust-analyzer...'); | 27 | vscode.window.showInformationMessage('Reloading rust-analyzer...'); |
@@ -28,7 +39,6 @@ export async function activate(context: vscode.ExtensionContext) { | |||
28 | } | 39 | } |
29 | }) | 40 | }) |
30 | 41 | ||
31 | // Commands which invokes manually via command palette, shortcut, etc. | ||
32 | ctx.registerCommand('analyzerStatus', commands.analyzerStatus); | 42 | ctx.registerCommand('analyzerStatus', commands.analyzerStatus); |
33 | ctx.registerCommand('collectGarbage', commands.collectGarbage); | 43 | ctx.registerCommand('collectGarbage', commands.collectGarbage); |
34 | ctx.registerCommand('matchingBrace', commands.matchingBrace); | 44 | ctx.registerCommand('matchingBrace', commands.matchingBrace); |
@@ -49,15 +59,6 @@ export async function activate(context: vscode.ExtensionContext) { | |||
49 | activateStatusDisplay(ctx); | 59 | activateStatusDisplay(ctx); |
50 | 60 | ||
51 | activateHighlighting(ctx); | 61 | activateHighlighting(ctx); |
52 | // Note: we try to start the server before we activate type hints so that it | ||
53 | // registers its `onDidChangeDocument` handler before us. | ||
54 | // | ||
55 | // This a horribly, horribly wrong way to deal with this problem. | ||
56 | try { | ||
57 | await ctx.startServer(); | ||
58 | } catch (e) { | ||
59 | vscode.window.showErrorMessage(e.message); | ||
60 | } | ||
61 | activateInlayHints(ctx); | 62 | activateInlayHints(ctx); |
62 | } | 63 | } |
63 | 64 | ||