diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 351c3a33c..2162b1fca 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -624,9 +624,16 @@ const getCommandsMap: ( } } }, - "continue.forceAutocomplete": () => { + "continue.forceAutocomplete": async () => { captureCommandTelemetry("forceAutocomplete"); - vscode.commands.executeCommand("editor.action.inlineSuggest.trigger"); + + // 1. Explicitly hide any existing suggestion. This clears VS Code's cache for the current position. + await vscode.commands.executeCommand("editor.action.inlineSuggest.hide"); + + // 2. Now trigger a new one. VS Code has no cached suggestion, so it's forced to call our provider. + await vscode.commands.executeCommand( + "editor.action.inlineSuggest.trigger", + ); }, "continue.openTabAutocompleteConfigMenu": async () => {