Skip to content

Commit 78548ea

Browse files
committed
callsites
1 parent 7f24ee4 commit 78548ea

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ActionRegistrar {
2929

3030
fun reportMessageClick(command: EditorContextCommand, project: Project) {
3131
if (command == EditorContextCommand.GenerateUnitTests) {
32-
AsyncChatUiListener.notifyPartialMessageUpdate(Gson().toJson(TestCommandMessage()))
32+
AsyncChatUiListener.notifyPartialMessageUpdate(project, Gson().toJson(TestCommandMessage()))
3333
} else {
3434
// new agentic chat route
3535
ApplicationManager.getApplication().executeOnPooledThread {
@@ -45,7 +45,7 @@ class ActionRegistrar {
4545
val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU)
4646
uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params)
4747
}
48-
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
48+
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
4949
}
5050
}
5151
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/codescan/actions/ExplainCodeIssueAction.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package software.aws.toolkits.jetbrains.services.cwc.commands.codescan.actions
55

66
import com.intellij.openapi.actionSystem.ActionManager
7+
import com.intellij.openapi.actionSystem.ActionUpdateThread
78
import com.intellij.openapi.actionSystem.AnAction
89
import com.intellij.openapi.actionSystem.AnActionEvent
910
import com.intellij.openapi.actionSystem.DataKey
@@ -18,7 +19,14 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SendT
1819
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.TriggerType
1920

2021
class ExplainCodeIssueAction : AnAction(), DumbAware {
22+
override fun getActionUpdateThread() = ActionUpdateThread.BGT
23+
24+
override fun update(e: AnActionEvent) {
25+
e.presentation.isEnabledAndVisible = e.project != null
26+
}
27+
2128
override fun actionPerformed(e: AnActionEvent) {
29+
val project = e.project ?: return
2230
val issueDataKey = DataKey.create<MutableMap<String, String>>("amazonq.codescan.explainissue")
2331
val issueContext = e.getData(issueDataKey) ?: return
2432

@@ -50,7 +58,7 @@ class ExplainCodeIssueAction : AnAction(), DumbAware {
5058
)
5159

5260
val uiMessage = FlareUiMessage(SEND_TO_PROMPT, params)
53-
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
61+
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
5462
}
5563
}
5664
}

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
315315

316316
override fun sendChatUpdate(params: LSPAny): CompletableFuture<Unit> {
317317
AsyncChatUiListener.notifyPartialMessageUpdate(
318+
project,
318319
FlareUiMessage(
319320
command = CHAT_SEND_UPDATE,
320321
params = params,

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/ChatCommunicationManager.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import java.util.concurrent.CompletableFuture
3737
import java.util.concurrent.ConcurrentHashMap
3838

3939
@Service(Service.Level.PROJECT)
40-
class ChatCommunicationManager(private val cs: CoroutineScope) {
40+
class ChatCommunicationManager(private val project: Project, private val cs: CoroutineScope) {
4141
val uiReady = CompletableDeferred<Boolean>()
4242
private val chatPartialResultMap = ConcurrentHashMap<String, String>()
4343
private val inflightRequestByTabId = ConcurrentHashMap<String, CompletableFuture<String>>()
@@ -53,7 +53,7 @@ class ChatCommunicationManager(private val cs: CoroutineScope) {
5353
fun notifyUi(uiMessage: FlareUiMessage) {
5454
cs.launch {
5555
uiReady.await()
56-
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
56+
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
5757
}
5858
}
5959

@@ -148,7 +148,7 @@ class ChatCommunicationManager(private val cs: CoroutineScope) {
148148
params = partialChatResult,
149149
isPartialResult = true
150150
)
151-
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
151+
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
152152
finalResultProcessed[token] = true
153153
ChatAsyncResultManager.getInstance(project).setResult(token, partialResultMap)
154154
return
@@ -169,7 +169,7 @@ class ChatCommunicationManager(private val cs: CoroutineScope) {
169169
params = partialChatResult,
170170
isPartialResult = true
171171
)
172-
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
172+
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
173173
}
174174
}
175175
}

0 commit comments

Comments
 (0)