diff --git a/src/extension.ts b/src/extension.ts index 62afc80..31e681e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -87,7 +87,7 @@ const tokenProvider = async ( document: vscode.TextDocument, position: vscode.Position, _context: vscode.InlineCompletionContext, - _token: vscode.CancellationToken, + token: vscode.CancellationToken, ) => { const prefix = document.getText(new vscode.Range(0, 0, position.line, position.character)); @@ -114,6 +114,10 @@ const tokenProvider = async ( }, }); + token.onCancellationRequested(() => { + response.abort(); + }); + const resultBuffer: string[] = await new Promise(async (resolve, reject) => { const buffer: string[] = []; const timeout = setTimeout(() => {