Skip to content

Commit

Permalink
Dedupe open tab logic / fix Q Review tab always using same UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
rli committed Dec 3, 2024
1 parent 8572bcb commit 4cb4dbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,20 @@ class AmazonQToolWindow private constructor(
}

fun getStarted(project: Project) {
// Make sure the window is shown
showChatWindow(project)

// Send the interaction message
val window = getInstance(project)
window.sendMessage(OnboardingPageInteraction(OnboardingPageInteractionType.CwcButtonClick), "cwc")
openTab(project, OnboardingPageInteraction(OnboardingPageInteractionType.CwcButtonClick), "cwc")
}

fun openScanTab(project: Project) {
openTab(project, runCodeScanMessage, "codescan")
}

private fun openTab(project: Project, message: AmazonQMessage, tabType: String) {
// Make sure the window is shown
showChatWindow(project)

// Send the interaction message
val window = getInstance(project)
window.sendMessageAppToUi(runCodeScanMessage, tabType = "codescan")
window.sendMessage(message, tabType)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ fun buildClearPromptProgressMessage(tabId: String) = PromptProgressMessage(
tabId = tabId
)

val runCodeScanMessage = CodeScanChatMessage(messageType = ChatMessageType.Prompt, command = "review", tabId = UUID.randomUUID().toString())
val runCodeScanMessage
get() = CodeScanChatMessage(messageType = ChatMessageType.Prompt, command = "review", tabId = UUID.randomUUID().toString())

val cancelFileScanButton = Button(
id = CodeScanButtonId.StopFileScan.id,
Expand Down

0 comments on commit 4cb4dbc

Please sign in to comment.