aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/main.ts
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-31 16:22:43 +0000
committerAleksey Kladov <[email protected]>2019-12-31 16:22:43 +0000
commite4b588868f822b9c200a8ce77d24bfab5aeca4b8 (patch)
tree6241f2088d0b1d8eeae9cceef4aee74a48d31993 /editors/code/src/main.ts
parent1327aed7f6289043091aa9179282030c6f13ddbe (diff)
Refactor status activation
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r--editors/code/src/main.ts17
1 files changed, 3 insertions, 14 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 0c4abdac8..511f17ca4 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -1,9 +1,8 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient';
3 2
4import * as commands from './commands'; 3import * as commands from './commands';
5import { activateInlayHints } from './inlay_hints'; 4import { activateInlayHints } from './inlay_hints';
6import { StatusDisplay } from './status_display'; 5import { activateStatusDisplay } from './status_display';
7import { Server } from './server'; 6import { Server } from './server';
8import { Ctx } from './ctx'; 7import { Ctx } from './ctx';
9import { activateHighlighting } from './highlighting'; 8import { activateHighlighting } from './highlighting';
@@ -32,18 +31,7 @@ export async function activate(context: vscode.ExtensionContext) {
32 ctx.overrideCommand('type', commands.onEnter); 31 ctx.overrideCommand('type', commands.onEnter);
33 } 32 }
34 33
35 const watchStatus = new StatusDisplay(ctx.config.cargoWatchOptions.command); 34 const startServer = () => Server.start();
36 ctx.pushCleanup(watchStatus);
37
38 // Notifications are events triggered by the language server
39 const allNotifications: [string, lc.GenericNotificationHandler][] = [
40 [
41 '$/progress',
42 params => watchStatus.handleProgressNotification(params),
43 ],
44 ];
45
46 const startServer = () => Server.start(allNotifications);
47 const reloadCommand = () => reloadServer(startServer); 35 const reloadCommand = () => reloadServer(startServer);
48 36
49 vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); 37 vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand);
@@ -55,6 +43,7 @@ export async function activate(context: vscode.ExtensionContext) {
55 vscode.window.showErrorMessage(e.message); 43 vscode.window.showErrorMessage(e.message);
56 } 44 }
57 45
46 activateStatusDisplay(ctx);
58 activateHighlighting(ctx); 47 activateHighlighting(ctx);
59 48
60 if (ctx.config.displayInlayHints) { 49 if (ctx.config.displayInlayHints) {