diff options
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r-- | editors/code/src/main.ts | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index d6c210579..7e63a9cac 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -2,7 +2,7 @@ import * as vscode from 'vscode'; | |||
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as lc from 'vscode-languageclient'; |
3 | 3 | ||
4 | import * as commands from './commands'; | 4 | import * as commands from './commands'; |
5 | import { HintsUpdater } 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'; | 7 | import * as events from './events'; |
8 | import * as notifications from './notifications'; | 8 | import * as notifications from './notifications'; |
@@ -37,10 +37,6 @@ export async function activate(context: vscode.ExtensionContext) { | |||
37 | ); | 37 | ); |
38 | ctx.pushCleanup(watchStatus); | 38 | ctx.pushCleanup(watchStatus); |
39 | 39 | ||
40 | function disposeOnDeactivation(disposable: vscode.Disposable) { | ||
41 | context.subscriptions.push(disposable); | ||
42 | } | ||
43 | |||
44 | // Notifications are events triggered by the language server | 40 | // Notifications are events triggered by the language server |
45 | const allNotifications: [string, lc.GenericNotificationHandler][] = [ | 41 | const allNotifications: [string, lc.GenericNotificationHandler][] = [ |
46 | [ | 42 | [ |
@@ -71,38 +67,7 @@ export async function activate(context: vscode.ExtensionContext) { | |||
71 | } | 67 | } |
72 | 68 | ||
73 | if (Server.config.displayInlayHints) { | 69 | if (Server.config.displayInlayHints) { |
74 | const hintsUpdater = new HintsUpdater(); | 70 | activateInlayHints(ctx); |
75 | hintsUpdater.refreshHintsForVisibleEditors().then(() => { | ||
76 | // vscode may ignore top level hintsUpdater.refreshHintsForVisibleEditors() | ||
77 | // so update the hints once when the focus changes to guarantee their presence | ||
78 | let editorChangeDisposable: vscode.Disposable | null = null; | ||
79 | editorChangeDisposable = vscode.window.onDidChangeActiveTextEditor( | ||
80 | _ => { | ||
81 | if (editorChangeDisposable !== null) { | ||
82 | editorChangeDisposable.dispose(); | ||
83 | } | ||
84 | return hintsUpdater.refreshHintsForVisibleEditors(); | ||
85 | }, | ||
86 | ); | ||
87 | |||
88 | disposeOnDeactivation( | ||
89 | vscode.window.onDidChangeVisibleTextEditors(_ => | ||
90 | hintsUpdater.refreshHintsForVisibleEditors(), | ||
91 | ), | ||
92 | ); | ||
93 | disposeOnDeactivation( | ||
94 | vscode.workspace.onDidChangeTextDocument(e => | ||
95 | hintsUpdater.refreshHintsForVisibleEditors(e), | ||
96 | ), | ||
97 | ); | ||
98 | disposeOnDeactivation( | ||
99 | vscode.workspace.onDidChangeConfiguration(_ => | ||
100 | hintsUpdater.toggleHintsDisplay( | ||
101 | Server.config.displayInlayHints, | ||
102 | ), | ||
103 | ), | ||
104 | ); | ||
105 | }); | ||
106 | } | 71 | } |
107 | } | 72 | } |
108 | 73 | ||