Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

fun reportMessageClick(command: EditorContextCommand, project: Project) {
if (command == EditorContextCommand.GenerateUnitTests) {
AsyncChatUiListener.notifyPartialMessageUpdate(Gson().toJson(TestCommandMessage()))
AsyncChatUiListener.notifyPartialMessageUpdate(project, Gson().toJson(TestCommandMessage()))

Check warning on line 32 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L32 was not covered by tests
} else {
// new agentic chat route
ApplicationManager.getApplication().executeOnPooledThread {
Expand All @@ -45,7 +45,7 @@
val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU)
uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params)
}
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)

Check warning on line 48 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L48 was not covered by tests
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package software.aws.toolkits.jetbrains.services.cwc.commands.codescan.actions

import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataKey
Expand All @@ -18,7 +19,14 @@
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.TriggerType

class ExplainCodeIssueAction : AnAction(), DumbAware {
override fun getActionUpdateThread() = ActionUpdateThread.BGT

Check warning on line 22 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/codescan/actions/ExplainCodeIssueAction.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L22 was not covered by tests

override fun update(e: AnActionEvent) {
e.presentation.isEnabledAndVisible = e.project != null
}

Check warning on line 26 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/codescan/actions/ExplainCodeIssueAction.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L26 was not covered by tests

override fun actionPerformed(e: AnActionEvent) {
val project = e.project ?: return
val issueDataKey = DataKey.create<MutableMap<String, String>>("amazonq.codescan.explainissue")
val issueContext = e.getData(issueDataKey) ?: return

Expand Down Expand Up @@ -50,7 +58,7 @@
)

val uiMessage = FlareUiMessage(SEND_TO_PROMPT, params)
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)

Check warning on line 61 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/codescan/actions/ExplainCodeIssueAction.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L61 was not covered by tests
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@

override fun sendChatUpdate(params: LSPAny): CompletableFuture<Unit> {
AsyncChatUiListener.notifyPartialMessageUpdate(
project,

Check warning on line 318 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L318 was not covered by tests
FlareUiMessage(
command = CHAT_SEND_UPDATE,
params = params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@

package software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.util.messages.Topic
import java.util.EventListener

@Deprecated("Why are we using a message bus for this????????")
interface AsyncChatUiListener : EventListener {
@Deprecated("shouldn't need this version")
fun onChange(command: String) {}

fun onChange(command: FlareUiMessage) {}

companion object {
@Topic.AppLevel
@Topic.ProjectLevel

Check warning on line 18 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AsyncChatUiListener.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L18 was not covered by tests
val TOPIC = Topic.create("Partial chat message provider", AsyncChatUiListener::class.java)

fun notifyPartialMessageUpdate(command: FlareUiMessage) {
ApplicationManager.getApplication().messageBus.syncPublisher(TOPIC).onChange(command)
@Deprecated("Why are we using a message bus for this????????")
fun notifyPartialMessageUpdate(project: Project, command: FlareUiMessage) {
project.messageBus.syncPublisher(TOPIC).onChange(command)

Check warning on line 23 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AsyncChatUiListener.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L23 was not covered by tests
}

@Deprecated("shouldn't need this version")
fun notifyPartialMessageUpdate(command: String) {
ApplicationManager.getApplication().messageBus.syncPublisher(TOPIC).onChange(command)
fun notifyPartialMessageUpdate(project: Project, command: String) {
project.messageBus.syncPublisher(TOPIC).onChange(command)

Check warning on line 28 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AsyncChatUiListener.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L28 was not covered by tests
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.concurrent.ConcurrentHashMap

@Service(Service.Level.PROJECT)
class ChatCommunicationManager(private val cs: CoroutineScope) {
class ChatCommunicationManager(private val project: Project, private val cs: CoroutineScope) {

Check warning on line 40 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/ChatCommunicationManager.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L40 was not covered by tests
val uiReady = CompletableDeferred<Boolean>()
private val chatPartialResultMap = ConcurrentHashMap<String, String>()
private val inflightRequestByTabId = ConcurrentHashMap<String, CompletableFuture<String>>()
Expand All @@ -53,7 +53,7 @@
fun notifyUi(uiMessage: FlareUiMessage) {
cs.launch {
uiReady.await()
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)

Check warning on line 56 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/ChatCommunicationManager.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L56 was not covered by tests
}
}

Expand Down Expand Up @@ -148,7 +148,7 @@
params = partialChatResult,
isPartialResult = true
)
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)

Check warning on line 151 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/ChatCommunicationManager.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L151 was not covered by tests
finalResultProcessed[token] = true
ChatAsyncResultManager.getInstance(project).setResult(token, partialResultMap)
return
Expand All @@ -169,7 +169,7 @@
params = partialChatResult,
isPartialResult = true
)
AsyncChatUiListener.notifyPartialMessageUpdate(uiMessage)
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)

Check warning on line 172 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/ChatCommunicationManager.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L172 was not covered by tests
}
}
}
Expand Down
Loading