-
Notifications
You must be signed in to change notification settings - Fork 731
feat(amazonq): auto-reject edit suggestions when cursor moves >25 lines away #7868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
|
✅ I finished the code review, and didn't find any security or code quality issues. |
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "type": "Feature", | |||
| "description": "auto-reject edit suggestions when cursor moves >25 lines away" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add the changelogs? the feature is not released yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted
| getLogger().info('Edit suggestion rejected') | ||
| await decorationManager.clearDecorations(editor) | ||
| documentChangeListener.dispose() | ||
| cursorChangeListener.dispose() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to add this method for reject case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, both accept and reject code paths represent the end of the suggestion lifecycle, so both must dispose of the listener to prevent memory leaks and ensure the listener doesn't continue running after the suggestion is already handled.
| void vscode.commands.executeCommand('aws.amazonq.inline.rejectEdit') | ||
| } | ||
| }) | ||
| const cursorChangeListener = vscode.window.onDidChangeTextEditorSelection((e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also add a screenshot of your testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shared video with group
…6b9-ac0e-7dc9dc9884af.json
|
Problem
Amazon Q edit suggestions remain active even when users navigate far away from the suggestion location, leading to confusion and potential unintended edits when users accept suggestions they can no longer see.
Solution
Added automatic rejection of edit suggestions when the cursor moves more than 25 lines away from the suggestion location. Implemented cursor change listener with proper cleanup to prevent memory leaks and ensure suggestions are only accepted when contextually relevant.
Fixed 2 failing recommendationService.test.ts tests
feature/xbranches will not be squash-merged at release time.