Skip to content

feat(amazonq): inline completion JB API migration #5851

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 9 commits into from
Jun 26, 2025

Conversation

andrewyuq
Copy link
Contributor

@andrewyuq andrewyuq commented Jun 24, 2025

There are many classes yet to be removed, e.g. most of the CodeWhispererService, CodeWhispererPopupManager, etc.
Will remove in future PRs.

    feat: migrate CodeWhisperer to native JetBrains inline completion API
        
    Refactor CodeWhisperer inline completion implementation to use JetBrains'
    native inline completion provider instead of custom popup-based system.
    
    Key changes:
    - Replace custom action handlers with QInlineCompletionProvider
    - Remove deprecated popup navigation and acceptance actions
    - Consolidate authentication logic for Amazon Q connections
    - Migrate from CodeWhispererConnection to QConnection
    - Remove custom action promoter for inline completion
    - Streamline auto-trigger handling and invocation status

  This change improves IDE integration and provides a more native
  completion experience for users.

Types of changes

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

Description

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.

@andrewyuq andrewyuq requested review from a team as code owners June 24, 2025 19:44
@andrewyuq andrewyuq requested a review from Copilot June 24, 2025 19:45
Copilot

This comment was marked as outdated.

  Refactor CodeWhisperer inline completion implementation to use JetBrains'
  native inline completion provider instead of custom popup-based system.

  Key changes:
  - Replace custom action handlers with QInlineCompletionProvider
  - Remove deprecated popup navigation and acceptance actions
  - Consolidate authentication logic for Amazon Q connections
  - Migrate from CodeWhispererConnection to QConnection
  - Remove custom action promoter for inline completion
  - Streamline auto-trigger handling and invocation status

  This change improves IDE integration and provides a more native
  completion experience for users.
@andrewyuq andrewyuq changed the title feature(amazonq): inline completion JB API migration feat(amazonq): inline completion JB API migration Jun 24, 2025
@andrewyuq andrewyuq requested a review from Copilot June 24, 2025 19:54
Copilot

This comment was marked as outdated.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

QDJVMC found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@andrewyuq andrewyuq requested a review from Copilot June 25, 2025 00:52
Copilot

This comment was marked as outdated.

@andrewyuq
Copy link
Contributor Author

/retryBuilds

@andrewyuq andrewyuq requested a review from Copilot June 25, 2025 19:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Refactor inline completion from CodeWhisperer’s custom popup to JetBrains’ native API and migrate all CodeWhisperer-specific connection code to use QConnection.

  • Remove all references to CodeWhispererConnection and simplify connection checks to QConnection.
  • Introduce QInlineCompletionProvider as the native inline completion provider along with UI components and telemetry integration.
  • Update telemetry viewer with a filter/search bar and deprecate popup-based action suites (tests are now ignored pending a rewrite).

Reviewed Changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 2 comments.

File Description
QMigrationActivity.kt Simplified migration logic; removed CodeWhisperer check
OpenTelemetryAction.kt Added search/filter bar for telemetry viewer UI
CodeWhispererPopupComponents.kt Switched navigation buttons to hard-coded arrows
Comments suppressed due to low confidence (1)

plugins/toolkit/jetbrains-core/src/software/aws/toolkits/jetbrains/core/startup/QMigrationActivity.kt:53

  • By removing the CodeWhispererConnection check, existing CodeWhisperer users will no longer trigger the Q plugin migration. Consider restoring a check for legacy CodeWhisperer usage to ensure those users are also prompted to install/migrate.
        if (hasUsedQ) {

Comment on lines +85 to +90
filterField.document.addDocumentListener(object : DocumentAdapter() {
override fun textChanged(e: DocumentEvent) {
// Filter console content based on filterField.text
applyFilter(filterField.text)
}
})
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

The DocumentAdapter listener is added but never removed, which can lead to memory leaks when the panel is disposed. Consider registering the listener with the panel’s Disposer or explicitly removing it when the toolbar is torn down.

Suggested change
filterField.document.addDocumentListener(object : DocumentAdapter() {
override fun textChanged(e: DocumentEvent) {
// Filter console content based on filterField.text
applyFilter(filterField.text)
}
})
val filterListener = object : DocumentAdapter() {
override fun textChanged(e: DocumentEvent) {
// Filter console content based on filterField.text
applyFilter(filterField.text)
}
}
filterField.document.addDocumentListener(filterListener)
Disposer.register(this) {
filterField.document.removeDocumentListener(filterListener)
}

Copilot uses AI. Check for mistakes.

@@ -44,7 +44,7 @@ import javax.swing.JLabel
import javax.swing.JPanel

class CodeWhispererPopupComponents {
val prevButton = createNavigationButton(prevButtonText())
val prevButton = createNavigationButton("←")
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

[nitpick] Hard-coding arrow characters can hamper localization and screen-reader support. Consider using an icon or a localized resource string for the button text to improve accessibility.

Copilot uses AI. Check for mistakes.

@samgst-amazon samgst-amazon merged commit 83e1a52 into aws:main Jun 26, 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