From 205aa50bb31fb5e7536089b17700ab444eba82de Mon Sep 17 00:00:00 2001 From: Vitaly Date: Wed, 9 Aug 2023 13:14:22 +0300 Subject: [PATCH] dispose event --- src/specialCommands.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/specialCommands.ts b/src/specialCommands.ts index 74931b2..b964446 100644 --- a/src/specialCommands.ts +++ b/src/specialCommands.ts @@ -254,11 +254,12 @@ export default () => { onCompletionAcceptedOverride.value = () => {} const { ranges, text } = await new Promise<{ text: string; ranges: vscode.Range[] }>(resolve => { - vscode.workspace.onDidChangeTextDocument(({ document, contentChanges }) => { + const { dispose } = vscode.workspace.onDidChangeTextDocument(({ document, contentChanges }) => { if (document !== editor.document || contentChanges.length === 0) return const ranges = contentChanges.map( change => new vscode.Range(change.range.start, offsetPosition(document, change.range.start, change.text.length)), ) + dispose() resolve({ ranges, text: contentChanges[0]!.text }) }) void vscode.commands.executeCommand('acceptSelectedSuggestion')