Skip to content

feat(amazonq): clicking on changed file in Q chat opens up file diff in editor #5675

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 4 commits into from
May 6, 2025

Conversation

samgst-amazon
Copy link
Contributor

Handle aws/openFileDiff notifications.

When user clicks a filename in Q chat, the file diff opens up in the editor:
Screenshot 2025-05-06 at 1 37 13 PM

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.

@samgst-amazon samgst-amazon requested review from a team as code owners May 6, 2025 20:45
Copy link

github-actions bot commented May 6, 2025

Qodana Community for JVM

2 new problems were found

Inspection name Severity Problems
Usage of redundant or deprecated syntax or deprecated symbols 🔶 Warning 2

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@@ -42,6 +46,9 @@
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.credentials.SsoProfileData
import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
import software.aws.toolkits.resources.message

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

Remove deprecated symbol import
}
}
val diffRequest = SimpleDiffRequest(
"$fileName ${message("aws.q.lsp.client.diff_message")}",

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
@@ -262,6 +269,45 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
return CompletableFuture.completedFuture(Unit)
}

override fun openFileDiff(params: OpenFileDiffParams): CompletableFuture<Unit> =
CompletableFuture.supplyAsync({
ApplicationManager.getApplication().invokeLater {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we follow the same pattern: #5663 (comment)?

LOG.warn { "Failed to open file diff: ${e.message}" }
}
}
Unit
Copy link
Contributor

Choose a reason for hiding this comment

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

not needed?

@@ -262,6 +269,45 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
return CompletableFuture.completedFuture(Unit)
}

override fun openFileDiff(params: OpenFileDiffParams): CompletableFuture<Unit> =
CompletableFuture.supplyAsync(
Copy link
Contributor

Choose a reason for hiding this comment

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

we should figure out how to move this onto coroutines

@samgst-amazon samgst-amazon merged commit e3082d2 into feature/q-lsp-chat May 6, 2025
14 of 16 checks passed
@samgst-amazon samgst-amazon deleted the samgst/q-lsp-chat-showDiff branch May 6, 2025 22:50
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