mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
vscode: eliminate floating promises and insane amount of resource handle leaks
This commit is contained in:
parent
8d0f7da2f5
commit
8153b60e1d
8 changed files with 34 additions and 19 deletions
|
@ -5,19 +5,27 @@ import { Ctx, sendRequestWithRetry } from './ctx';
|
|||
|
||||
export function activateInlayHints(ctx: Ctx) {
|
||||
const hintsUpdater = new HintsUpdater(ctx);
|
||||
vscode.window.onDidChangeVisibleTextEditors(async _ => {
|
||||
await hintsUpdater.refresh();
|
||||
}, ctx.subscriptions);
|
||||
vscode.window.onDidChangeVisibleTextEditors(
|
||||
async _ => hintsUpdater.refresh(),
|
||||
null,
|
||||
ctx.subscriptions
|
||||
);
|
||||
|
||||
vscode.workspace.onDidChangeTextDocument(async e => {
|
||||
if (e.contentChanges.length === 0) return;
|
||||
if (e.document.languageId !== 'rust') return;
|
||||
await hintsUpdater.refresh();
|
||||
}, ctx.subscriptions);
|
||||
vscode.workspace.onDidChangeTextDocument(
|
||||
async event => {
|
||||
if (event.contentChanges.length !== 0) return;
|
||||
if (event.document.languageId !== 'rust') return;
|
||||
await hintsUpdater.refresh();
|
||||
},
|
||||
null,
|
||||
ctx.subscriptions
|
||||
);
|
||||
|
||||
vscode.workspace.onDidChangeConfiguration(_ => {
|
||||
hintsUpdater.setEnabled(ctx.config.displayInlayHints);
|
||||
}, ctx.subscriptions);
|
||||
vscode.workspace.onDidChangeConfiguration(
|
||||
async _ => hintsUpdater.setEnabled(ctx.config.displayInlayHints),
|
||||
null,
|
||||
ctx.subscriptions
|
||||
);
|
||||
|
||||
ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue