aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/inlay_hints.ts
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-05 20:57:08 +0000
committerGitHub <[email protected]>2020-02-05 20:57:08 +0000
commitea9d18ba836a7228f7310e1bc77c0918f0191a42 (patch)
tree64b3cabe122d06484a521ff2428f2ca1e4df1d48 /editors/code/src/inlay_hints.ts
parent2471b6bc3a318d7303d0556c85940090b6cf6d7a (diff)
parent8153b60e1d8abdcefbf6c7c9657f1ce65a216d7a (diff)
Merge #3024
3024: vscode: eliminate floating promises and insane amount of resource handle leaks r=matklad a=Veetaha Khm, yeah ... Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'editors/code/src/inlay_hints.ts')
-rw-r--r--editors/code/src/inlay_hints.ts34
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
6export function activateInlayHints(ctx: Ctx) { 6export 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}