Skip to content

Conversation

manodnyab
Copy link
Contributor

@manodnyab manodnyab commented Jul 24, 2025

Types of changes

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

Description

Add the ability to collect logs from chat with one click

Screenshot 2025-07-31 at 4 36 25 PM Screenshot 2025-07-31 at 4 31 02 PM

License

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

Copy link

Qodana Community for JVM

4 new problems were found

Inspection name Severity Problems
Incorrect string capitalization 🔶 Warning 2
Unstable API Usage 🔶 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 [email protected]

Copy link

github-actions bot commented Jul 25, 2025

Qodana Community for JVM

4 new problems were found

Inspection name Severity Problems
Unstable API Usage 🔶 Warning 2
Companion object in extensions 🔶 Warning 1
Incorrect string capitalization 🔶 Warning 1

💡 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 [email protected]

@manodnyab manodnyab marked this pull request as ready for review July 30, 2025 18:05
@manodnyab manodnyab requested a review from a team as a code owner July 31, 2025 23:33
import software.aws.toolkits.resources.AmazonQBundle.message

class GetAmazonQLogsAction : DumbAwareAction(
AmazonQBundle.message("amazonq.getLogs.tooltip.text")
Copy link
Contributor

Choose a reason for hiding this comment

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


override fun update(e: AnActionEvent) {
super.update(e)
val baseIcon = IconLoader.getIcon("/icons/file.svg", GetAmazonQLogsAction::class.java)
Copy link
Contributor

Choose a reason for hiding this comment

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

icon loader has a cache, but load the icon once in the action initialization so we are not constantly trying to do this on EDT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving the value to class variables and updating the usage in update

Comment on lines 47 to 49
val action = ActionManager.getInstance().getAction("CollectZippedLogs")
val datacontxt = SimpleDataContext.builder().add(CommonDataKeys.PROJECT, project).build()
val ae = AnActionEvent.createEvent(action, datacontxt, null, ActionPlaces.UNKNOWN, ActionUiKind.POPUP, null)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is technically internal so we should have a test

fun showLogCollectionWarningGetLogs(project: Project) {
try {
val action = ActionManager.getInstance().getAction("CollectZippedLogs")
val datacontxt = SimpleDataContext.builder().add(CommonDataKeys.PROJECT, project).build()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
val datacontxt = SimpleDataContext.builder().add(CommonDataKeys.PROJECT, project).build()
val dataContext = SimpleDataContext.builder().add(CommonDataKeys.PROJECT, project).build()

showLogCollectionWarningGetLogs(project)
}

companion object {

Check warning

Code scanning / QDJVMC

Companion object in extensions Warning

Companion objects in IDE extension implementations may only contain a logger and constants
fun showLogCollectionWarningGetLogs(project: Project) {
if (Messages.showOkCancelDialog(
message("amazonq.logs.warning"),
message("amazonq.getLogs"),

Check warning

Code scanning / QDJVMC

Incorrect string capitalization Warning

String 'Get Amazon Q logs' is not properly capitalized. It should have title capitalization
runUnderProgressIfNeeded(project, message("amazonq.getLogs"), cancelable = true) {
runBlocking {
try {
RevealFileAction.openFile(LogPacker.packLogs(project))

Check warning

Code scanning / QDJVMC

Unstable API Usage Warning

'com.intellij.ide.logsUploader.LogPacker' is marked unstable with @ApiStatus.Internal
runUnderProgressIfNeeded(project, message("amazonq.getLogs"), cancelable = true) {
runBlocking {
try {
RevealFileAction.openFile(LogPacker.packLogs(project))

Check warning

Code scanning / QDJVMC

Unstable API Usage Warning

'packLogs(com.intellij.openapi.project.Project, kotlin.coroutines.Continuation)' is declared in unstable 'com.intellij.ide.logsUploader.LogPacker' marked with @ApiStatus.Internal
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Investigating moving to another action in a follow up PR

@manodnyab manodnyab merged commit b66fb94 into main Aug 7, 2025
23 of 24 checks passed
@manodnyab manodnyab deleted the manodnyb/fixThinkingBug branch August 7, 2025 19:07
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.

4 participants