Skip to content

Commit 4cb4dbc

Browse files
committed
Dedupe open tab logic / fix Q Review tab always using same UUID
1 parent 8572bcb commit 4cb4dbc

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindow.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,20 @@ class AmazonQToolWindow private constructor(
155155
}
156156

157157
fun getStarted(project: Project) {
158-
// Make sure the window is shown
159-
showChatWindow(project)
160-
161-
// Send the interaction message
162-
val window = getInstance(project)
163-
window.sendMessage(OnboardingPageInteraction(OnboardingPageInteractionType.CwcButtonClick), "cwc")
158+
openTab(project, OnboardingPageInteraction(OnboardingPageInteractionType.CwcButtonClick), "cwc")
164159
}
165160

166161
fun openScanTab(project: Project) {
162+
openTab(project, runCodeScanMessage, "codescan")
163+
}
164+
165+
private fun openTab(project: Project, message: AmazonQMessage, tabType: String) {
166+
// Make sure the window is shown
167167
showChatWindow(project)
168+
169+
// Send the interaction message
168170
val window = getInstance(project)
169-
window.sendMessageAppToUi(runCodeScanMessage, tabType = "codescan")
171+
window.sendMessage(message, tabType)
170172
}
171173
}
172174

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeScan/CodeScanChatItems.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ fun buildClearPromptProgressMessage(tabId: String) = PromptProgressMessage(
128128
tabId = tabId
129129
)
130130

131-
val runCodeScanMessage = CodeScanChatMessage(messageType = ChatMessageType.Prompt, command = "review", tabId = UUID.randomUUID().toString())
131+
val runCodeScanMessage
132+
get() = CodeScanChatMessage(messageType = ChatMessageType.Prompt, command = "review", tabId = UUID.randomUUID().toString())
132133

133134
val cancelFileScanButton = Button(
134135
id = CodeScanButtonId.StopFileScan.id,

0 commit comments

Comments
 (0)