aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/main.ts
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-30 21:57:08 +0000
committerGitHub <[email protected]>2019-12-30 21:57:08 +0000
commitc3d74744cdae29aa6a6bfa0cd7ab64b8b251e287 (patch)
treebf53aac74110d30eba6da346e764e003ffd8b9c4 /editors/code/src/main.ts
parent17dda0972a68dd88a766c223390317dc2cb3ea00 (diff)
parentcdd7118cbf23e21c376092b3b2734407004b8dbf (diff)
Merge #2694
2694: Refactor inlay hints r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r--editors/code/src/main.ts17
1 files changed, 6 insertions, 11 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 7e63a9cac..345ae0685 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -4,10 +4,10 @@ import * as lc from 'vscode-languageclient';
4import * as commands from './commands'; 4import * as commands from './commands';
5import { activateInlayHints } from './inlay_hints'; 5import { activateInlayHints } from './inlay_hints';
6import { StatusDisplay } from './status_display'; 6import { StatusDisplay } from './status_display';
7import * as events from './events';
8import * as notifications from './notifications'; 7import * as notifications from './notifications';
9import { Server } from './server'; 8import { Server } from './server';
10import { Ctx } from './ctx'; 9import { Ctx } from './ctx';
10import { activateHighlighting } from './highlighting';
11 11
12let ctx!: Ctx; 12let ctx!: Ctx;
13 13
@@ -28,15 +28,15 @@ export async function activate(context: vscode.ExtensionContext) {
28 ctx.registerCommand('runSingle', commands.runSingle); 28 ctx.registerCommand('runSingle', commands.runSingle);
29 ctx.registerCommand('showReferences', commands.showReferences); 29 ctx.registerCommand('showReferences', commands.showReferences);
30 30
31 if (Server.config.enableEnhancedTyping) { 31 if (ctx.config.enableEnhancedTyping) {
32 ctx.overrideCommand('type', commands.onEnter); 32 ctx.overrideCommand('type', commands.onEnter);
33 } 33 }
34 34
35 const watchStatus = new StatusDisplay( 35 const watchStatus = new StatusDisplay(ctx.config.cargoWatchOptions.command);
36 Server.config.cargoWatchOptions.command,
37 );
38 ctx.pushCleanup(watchStatus); 36 ctx.pushCleanup(watchStatus);
39 37
38 activateHighlighting(ctx);
39
40 // Notifications are events triggered by the language server 40 // Notifications are events triggered by the language server
41 const allNotifications: [string, lc.GenericNotificationHandler][] = [ 41 const allNotifications: [string, lc.GenericNotificationHandler][] = [
42 [ 42 [
@@ -49,11 +49,6 @@ export async function activate(context: vscode.ExtensionContext) {
49 ], 49 ],
50 ]; 50 ];
51 51
52 // The events below are plain old javascript events, triggered and handled by vscode
53 vscode.window.onDidChangeActiveTextEditor(
54 events.changeActiveTextEditor.makeHandler(),
55 );
56
57 const startServer = () => Server.start(allNotifications); 52 const startServer = () => Server.start(allNotifications);
58 const reloadCommand = () => reloadServer(startServer); 53 const reloadCommand = () => reloadServer(startServer);
59 54
@@ -66,7 +61,7 @@ export async function activate(context: vscode.ExtensionContext) {
66 vscode.window.showErrorMessage(e.message); 61 vscode.window.showErrorMessage(e.message);
67 } 62 }
68 63
69 if (Server.config.displayInlayHints) { 64 if (ctx.config.displayInlayHints) {
70 activateInlayHints(ctx); 65 activateInlayHints(ctx);
71 } 66 }
72} 67}