Skip to content
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

fix(amazonq): code review navigation not focusing selected issues #5326

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

zuoyaofu
Copy link

@zuoyaofu zuoyaofu commented Feb 5, 2025

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

Problem:

When reviewing code issues in Amazon Q, clicking or using arrow keys to select an issue does not:

  • Focus the code editor on the relevant line
  • Display the issue details/description

Solution:

  • Added TreeSelectionListener in codeScanTree to detect selection of an issue
  • Removed Redundant MouseListener Logic since click would automatically invoke selection

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@zuoyaofu zuoyaofu changed the title fix(amazonq): single click or select through arrow keys on review cod… fix(amazonq): code review navigation not focusing selected issues Feb 5, 2025
@zuoyaofu zuoyaofu marked this pull request as ready for review February 5, 2025 09:47
@zuoyaofu zuoyaofu requested review from a team as code owners February 5, 2025 09:47
@@ -390,8 +395,31 @@ internal class CodeWhispererCodeScanResultsView(private val project: Project, pr
}
}

// Move navigateToIssue as a private class function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this comment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh before, the navigateToIssue was in the On double click function. This comment does not make sense anymore now. Let me delete it.


showIssueDetails(issue, defaultScope)

synchronized(issueNode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly does the synchronized block solve?

Copy link
Author

@zuoyaofu zuoyaofu Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a logic transfer from the OnDoubleClick function.

My guess is that it prevents the issue from being modified (by auto scan completion which modifies the code issues or other selection?) during the execution of navigating to the line in the Editor, but I have not been able to reproduce such scenario. I left the synchronized block there just in case.

@ctlai95
Copy link
Contributor

ctlai95 commented Feb 7, 2025

/retryBuilds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants