Skip to content

Commit 64edd0e

Browse files
authored
fix(amazonq): Skip prefix matching for Edits suggestions that trigger on acceptance (#7814)
## Problem For Edits pagination case, we always send discard telemetry even though there are pending Edits suggestions. The root cause is due to prefix matching logic (we always send discard telemetry if the prefix does not match). ## Solution Skip prefix matching for Edits suggestions that trigger on acceptance (pagination case) --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 712d978 commit 64edd0e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/amazonq/src/app/inline/completion.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,16 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
290290
const prevSessionId = prevSession?.sessionId
291291
const prevItemId = this.sessionManager.getActiveRecommendation()?.[0]?.itemId
292292
const prevStartPosition = prevSession?.startPosition
293-
if (prevSession?.triggerOnAcceptance) {
293+
const editsTriggerOnAcceptance = prevSession?.triggerOnAcceptance
294+
if (editsTriggerOnAcceptance) {
294295
getAllRecommendationsOptions = {
295296
...getAllRecommendationsOptions,
296297
editsStreakToken: prevSession?.editsStreakPartialResultToken,
297298
}
298299
}
299300
const editor = window.activeTextEditor
300-
if (prevSession && prevSessionId && prevItemId && prevStartPosition) {
301+
// Skip prefix matching for Edits suggestions that trigger on acceptance.
302+
if (prevSession && prevSessionId && prevItemId && prevStartPosition && !editsTriggerOnAcceptance) {
301303
const prefix = document.getText(new Range(prevStartPosition, position))
302304
const prevItemMatchingPrefix = []
303305
for (const item of this.sessionManager.getActiveRecommendation()) {

0 commit comments

Comments
 (0)