diff options
Diffstat (limited to 'editors/code/src/extension.ts')
-rw-r--r-- | editors/code/src/extension.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts index c8c3004a7..c6efc2e7e 100644 --- a/editors/code/src/extension.ts +++ b/editors/code/src/extension.ts | |||
@@ -3,6 +3,7 @@ import * as lc from 'vscode-languageclient'; | |||
3 | 3 | ||
4 | import * as commands from './commands'; | 4 | import * as commands from './commands'; |
5 | import { CargoWatchProvider } from './commands/cargo_watch'; | 5 | import { CargoWatchProvider } from './commands/cargo_watch'; |
6 | import { HintsUpdater } from './commands/inlay_hints'; | ||
6 | import { | 7 | import { |
7 | interactivelyStartCargoWatch, | 8 | interactivelyStartCargoWatch, |
8 | startCargoWatch | 9 | startCargoWatch |
@@ -147,6 +148,29 @@ export function activate(context: vscode.ExtensionContext) { | |||
147 | 148 | ||
148 | // Start the language server, finally! | 149 | // Start the language server, finally! |
149 | startServer(); | 150 | startServer(); |
151 | |||
152 | if (Server.config.displayInlayHints) { | ||
153 | const hintsUpdater = new HintsUpdater(); | ||
154 | hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { | ||
155 | disposeOnDeactivation( | ||
156 | vscode.window.onDidChangeActiveTextEditor(editor => | ||
157 | hintsUpdater.loadHints(editor) | ||
158 | ) | ||
159 | ); | ||
160 | disposeOnDeactivation( | ||
161 | vscode.workspace.onDidChangeTextDocument(e => | ||
162 | hintsUpdater.updateHints(e) | ||
163 | ) | ||
164 | ); | ||
165 | disposeOnDeactivation( | ||
166 | vscode.workspace.onDidChangeConfiguration(_ => | ||
167 | hintsUpdater.toggleHintsDisplay( | ||
168 | Server.config.displayInlayHints | ||
169 | ) | ||
170 | ) | ||
171 | ); | ||
172 | }); | ||
173 | } | ||
150 | } | 174 | } |
151 | 175 | ||
152 | export function deactivate(): Thenable<void> { | 176 | export function deactivate(): Thenable<void> { |