aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/commands/inlay_hints.ts6
-rw-r--r--editors/code/src/extension.ts26
2 files changed, 22 insertions, 10 deletions
diff --git a/editors/code/src/commands/inlay_hints.ts b/editors/code/src/commands/inlay_hints.ts
index ba9966161..8154af8dc 100644
--- a/editors/code/src/commands/inlay_hints.ts
+++ b/editors/code/src/commands/inlay_hints.ts
@@ -25,7 +25,11 @@ export class HintsUpdater {
25 public async loadHints( 25 public async loadHints(
26 editor: vscode.TextEditor | undefined 26 editor: vscode.TextEditor | undefined
27 ): Promise<void> { 27 ): Promise<void> {
28 if (this.displayHints && editor !== undefined && this.isRustDocument(editor.document)) { 28 if (
29 this.displayHints &&
30 editor !== undefined &&
31 this.isRustDocument(editor.document)
32 ) {
29 await this.updateDecorationsFromServer( 33 await this.updateDecorationsFromServer(
30 editor.document.uri.toString(), 34 editor.document.uri.toString(),
31 editor 35 editor
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 9bee75394..c6efc2e7e 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -152,15 +152,23 @@ export function activate(context: vscode.ExtensionContext) {
152 if (Server.config.displayInlayHints) { 152 if (Server.config.displayInlayHints) {
153 const hintsUpdater = new HintsUpdater(); 153 const hintsUpdater = new HintsUpdater();
154 hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { 154 hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => {
155 disposeOnDeactivation(vscode.window.onDidChangeActiveTextEditor(editor => 155 disposeOnDeactivation(
156 hintsUpdater.loadHints(editor) 156 vscode.window.onDidChangeActiveTextEditor(editor =>
157 )); 157 hintsUpdater.loadHints(editor)
158 disposeOnDeactivation(vscode.workspace.onDidChangeTextDocument(e => 158 )
159 hintsUpdater.updateHints(e) 159 );
160 )); 160 disposeOnDeactivation(
161 disposeOnDeactivation(vscode.workspace.onDidChangeConfiguration(_ => 161 vscode.workspace.onDidChangeTextDocument(e =>
162 hintsUpdater.toggleHintsDisplay(Server.config.displayInlayHints) 162 hintsUpdater.updateHints(e)
163 )); 163 )
164 );
165 disposeOnDeactivation(
166 vscode.workspace.onDidChangeConfiguration(_ =>
167 hintsUpdater.toggleHintsDisplay(
168 Server.config.displayInlayHints
169 )
170 )
171 );
164 }); 172 });
165 } 173 }
166} 174}