diff options
Diffstat (limited to 'editors/code/src/inlay_hints.ts')
-rw-r--r-- | editors/code/src/inlay_hints.ts | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index ae7510183..1c019a51b 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts | |||
@@ -5,19 +5,27 @@ import { Ctx, sendRequestWithRetry } from './ctx'; | |||
5 | 5 | ||
6 | export function activateInlayHints(ctx: Ctx) { | 6 | export function activateInlayHints(ctx: Ctx) { |
7 | const hintsUpdater = new HintsUpdater(ctx); | 7 | const hintsUpdater = new HintsUpdater(ctx); |
8 | vscode.window.onDidChangeVisibleTextEditors(async _ => { | 8 | vscode.window.onDidChangeVisibleTextEditors( |
9 | await hintsUpdater.refresh(); | 9 | async _ => hintsUpdater.refresh(), |
10 | }, ctx.subscriptions); | 10 | null, |
11 | 11 | ctx.subscriptions | |
12 | vscode.workspace.onDidChangeTextDocument(async e => { | 12 | ); |
13 | if (e.contentChanges.length === 0) return; | 13 | |
14 | if (e.document.languageId !== 'rust') return; | 14 | vscode.workspace.onDidChangeTextDocument( |
15 | await hintsUpdater.refresh(); | 15 | async event => { |
16 | }, ctx.subscriptions); | 16 | if (event.contentChanges.length !== 0) return; |
17 | 17 | if (event.document.languageId !== 'rust') return; | |
18 | vscode.workspace.onDidChangeConfiguration(_ => { | 18 | await hintsUpdater.refresh(); |
19 | hintsUpdater.setEnabled(ctx.config.displayInlayHints); | 19 | }, |
20 | }, ctx.subscriptions); | 20 | null, |
21 | ctx.subscriptions | ||
22 | ); | ||
23 | |||
24 | vscode.workspace.onDidChangeConfiguration( | ||
25 | async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints), | ||
26 | null, | ||
27 | ctx.subscriptions | ||
28 | ); | ||
21 | 29 | ||
22 | ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); | 30 | ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); |
23 | } | 31 | } |