diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-30 21:57:08 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-30 21:57:08 +0000 |
commit | c3d74744cdae29aa6a6bfa0cd7ab64b8b251e287 (patch) | |
tree | bf53aac74110d30eba6da346e764e003ffd8b9c4 /editors/code/src/main.ts | |
parent | 17dda0972a68dd88a766c223390317dc2cb3ea00 (diff) | |
parent | cdd7118cbf23e21c376092b3b2734407004b8dbf (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.ts | 17 |
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'; | |||
4 | import * as commands from './commands'; | 4 | import * as commands from './commands'; |
5 | import { activateInlayHints } from './inlay_hints'; | 5 | import { activateInlayHints } from './inlay_hints'; |
6 | import { StatusDisplay } from './status_display'; | 6 | import { StatusDisplay } from './status_display'; |
7 | import * as events from './events'; | ||
8 | import * as notifications from './notifications'; | 7 | import * as notifications from './notifications'; |
9 | import { Server } from './server'; | 8 | import { Server } from './server'; |
10 | import { Ctx } from './ctx'; | 9 | import { Ctx } from './ctx'; |
10 | import { activateHighlighting } from './highlighting'; | ||
11 | 11 | ||
12 | let ctx!: Ctx; | 12 | let 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 | } |