From 2cbfe9748fc38b1c7f0207389e69ef8a883dc436 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Wed, 30 Jul 2025 17:28:29 -0700 Subject: [PATCH] fix: model should now recompute outcome at each next edit location --- .../src/autocomplete/completionProvider.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/extensions/vscode/src/autocomplete/completionProvider.ts b/extensions/vscode/src/autocomplete/completionProvider.ts index 452df25a6..55214732b 100644 --- a/extensions/vscode/src/autocomplete/completionProvider.ts +++ b/extensions/vscode/src/autocomplete/completionProvider.ts @@ -432,10 +432,29 @@ export class ContinueCompletionProvider 0 && !jumpSuccessful ) { + // NOTE: Outcome has to be re-computed for each next editable location. const nextRegion = - this.nextEditProvider.shiftNextEditableRegionsInTheCurrentChain(); + this.nextEditProvider.getNextEditableRegionsInTheCurrentChain()[0]; if (!nextRegion) continue; + // Getting the outcome shifts the next editable region queue, + // deleting the item denoted by nextRegion above. + outcome = + await this.nextEditProvider.provideInlineCompletionItemsWithChain( + { + completionId, + manuallyPassFileContents, + manuallyPassPrefix, + selectedCompletionInfo, + isUntitledFile: document.isUntitled, + recentlyVisitedRanges, + recentlyEditedRanges, + }, + signal, + ); + + if (!outcome) continue; + const jumpPosition = new vscode.Position( nextRegion.range.start.line, nextRegion.range.start.character,