Skip to content

refactor(amazonq): remove redunant panel re-creation #5729

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

Merged
merged 7 commits into from
May 20, 2025

Conversation

Will-ShaoHua
Copy link
Contributor

@Will-ShaoHua Will-ShaoHua commented May 16, 2025

Types of changes

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

Description

related to https://youtrack.jetbrains.com/issue/IJPL-186252

if disposeAndRecreate gets called multiple times within short duration, i will crash the IDE.

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.

@Will-ShaoHua Will-ShaoHua marked this pull request as ready for review May 16, 2025 23:33
@Will-ShaoHua Will-ShaoHua requested a review from a team as a code owner May 16, 2025 23:33
@Will-ShaoHua Will-ShaoHua requested review from rli and manodnyab May 16, 2025 23:33
@@ -85,8 +85,7 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware {
object : BearerTokenProviderListener {
override fun onChange(providerId: String, newScopes: List<String>?) {
if (ToolkitConnectionManager.getInstance(project).connectionStateForFeature(QConnection.getInstance()) == BearerTokenAuthState.AUTHORIZED) {
AmazonQToolWindow.getInstance(project).disposeAndRecreate()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not necessary to re-init an entire new panel

@@ -98,13 +97,12 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware {
// note we name myProject intentionally ow it will shadow the "project" provided by the IDE
override fun onProfileSelected(myProject: Project, profile: QRegionProfile?) {
if (project.isDisposed) return
AmazonQToolWindow.getInstance(project).disposeAndRecreate()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: send active profile to LSP so that LSP can render selected profile in a card

@Will-ShaoHua Will-ShaoHua changed the title remove redunant panel re-creation refactor(amazonq): remove redunant panel re-creation May 19, 2025
@rli rli merged commit 3828011 into aws:feature/q-lsp-chat May 20, 2025
11 of 12 checks passed
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.

2 participants