You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(amazonq): block completion before active edit is accepted/rejected (#8141)
## Problem
Both completion suggestions (ghost text) and edit suggestions (diff
view) could appear simultaneously due to a race condition. The
EditSuggestionState flag was set too late in the edit display flow,
allowing completion requests to check the state, see it as false, and
proceed even while an edit was being displayed.
## Solution
Fixed the race condition by setting the edit state immediately at the
start of displaySvgDecoration() before any async operations:
* Set EditSuggestionState to true at the beginning of the edit flow
* Add state cleanup when edit cannot be shown (completion already active
or invalid patch)
* Avoid calling clearDecorations() in displayEditSuggestion() to prevent
premature state reset
* Check EditSuggestionState before making completion requests in
recommendationService.ts.
This ensures only one suggestion type is displayed at a time with proper
mutual exclusion.
---
- 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.
Copy file name to clipboardExpand all lines: packages/amazonq/src/app/inline/recommendationService.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -138,7 +138,7 @@ export class RecommendationService {
138
138
* Completions use PartialResultToken with single 1 call of [getAllRecommendations].
139
139
* Edits leverage partialResultToken to achieve EditStreak such that clients can pull all continuous suggestions generated by the model within 1 EOS block.
0 commit comments