Skip to content

Commit 53f62ee

Browse files
authored
Merge branch 'main' into wcs_optin
2 parents b829217 + ce3a4ed commit 53f62ee

File tree

21 files changed

+86
-203
lines changed

21 files changed

+86
-203
lines changed

buildSrc/src/main/kotlin/temp-toolkit-intellij-root-conventions.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ intellijPlatform {
5353
tasks.prepareSandbox {
5454
val pluginName = intellijPlatform.projectName
5555

56-
intoChild(pluginName.map { "$it/dotnet" })
57-
.from(resharperDlls)
56+
from(resharperDlls) {
57+
into(pluginName.map { "$it/dotnet" })
58+
}
5859

59-
intoChild(pluginName.map { "$it/gateway-resources" })
60-
.from(gatewayResources)
60+
from(gatewayResources) {
61+
into(pluginName.map { "$it/gateway-resources" })
62+
}
6163
}
6264

6365
// We have no source in this project, so skip test task

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ detekt = "1.23.8"
1010
diff-util = "4.12"
1111
intellijExt = "1.1.8"
1212
# match with <root>/settings.gradle.kts
13-
intellijGradle = "2.6.0"
13+
intellijGradle = "2.7.1"
1414
intellijRemoteRobot = "0.11.22"
1515
jackson = "2.17.2"
1616
jacoco = "0.8.12"

plugins/amazonq/build.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ val prepareBundledFlare by tasks.registering(Copy::class) {
133133
}
134134

135135
tasks.withType<PrepareSandboxTask>().configureEach {
136-
intoChild(intellijPlatform.projectName.map { "$it/lib" })
137-
.from(file("contrib/QCT-Maven-6-16.jar"))
138-
intoChild(intellijPlatform.projectName.map { "$it/flare" })
139-
.from(prepareBundledFlare)
136+
from(file("contrib/QCT-Maven-6-16.jar")) {
137+
into(intellijPlatform.projectName.map { "$it/lib" })
138+
}
139+
from(prepareBundledFlare) {
140+
into(intellijPlatform.projectName.map { "$it/flare" })
141+
}
140142
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import software.aws.toolkits.jetbrains.services.amazonq.isQSupportedInThisVersio
3232
import software.aws.toolkits.jetbrains.services.amazonq.lsp.AmazonQLspService
3333
import software.aws.toolkits.jetbrains.services.amazonq.lsp.artifacts.ArtifactManager
3434
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AsyncChatUiListener
35+
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.ChatCommunicationManager
3536
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.FlareUiMessage
3637
import software.aws.toolkits.jetbrains.services.amazonq.messages.AmazonQMessage
3738
import software.aws.toolkits.jetbrains.services.amazonq.messages.MessageConnector
@@ -66,6 +67,7 @@ class AmazonQPanel(val project: Project, private val scope: CoroutineScope) : Di
6667
private val appConnections = mutableListOf<AppConnection>()
6768

6869
init {
70+
// will be removed in next iteration.
6971
project.messageBus.connect().subscribe(
7072
AsyncChatUiListener.TOPIC,
7173
object : AsyncChatUiListener {
@@ -135,6 +137,11 @@ class AmazonQPanel(val project: Project, private val scope: CoroutineScope) : Di
135137
Browser(this@AmazonQPanel, webUri, project).also { browserInstance ->
136138
wrapper.setContent(browserInstance.component())
137139

140+
// Register direct callback instead of using message bus
141+
ChatCommunicationManager.getInstance(project).setChatUpdateCallback { message ->
142+
browserInstance.postChat(message)
143+
}
144+
138145
// Add DropTarget to the browser component
139146
// JCEF does not propagate OS-level dragenter, dragOver and drop into DOM.
140147
// As an alternative, enabling the native drag in JCEF,

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/BrowserConnector.kt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.JsonRpcNotification
4343
import software.aws.toolkits.jetbrains.services.amazonq.lsp.JsonRpcRequest
4444
import software.aws.toolkits.jetbrains.services.amazonq.lsp.encryption.JwtEncryptionManager
4545
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AwsServerCapabilitiesProvider
46-
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.ChatAsyncResultManager
4746
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.ChatCommunicationManager
4847
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.FlareUiMessage
4948
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.AUTH_FOLLOW_UP_CLICKED
@@ -123,7 +122,6 @@ class BrowserConnector(
123122
) {
124123
val uiReady = CompletableDeferred<Boolean>()
125124
private val chatCommunicationManager = ChatCommunicationManager.getInstance(project)
126-
private val chatAsyncResultManager = ChatAsyncResultManager.getInstance(project)
127125

128126
suspend fun connect(
129127
browser: Browser,
@@ -240,7 +238,6 @@ class BrowserConnector(
240238

241239
val tabId = requestFromUi.params.tabId
242240
val partialResultToken = chatCommunicationManager.addPartialChatMessage(tabId)
243-
chatCommunicationManager.registerPartialResultToken(partialResultToken)
244241

245242
var encryptionManager: JwtEncryptionManager? = null
246243
val result = AmazonQLspService.executeAsyncIfRunning(project) { server ->
@@ -261,7 +258,6 @@ class BrowserConnector(
261258
val tabId = requestFromUi.params.tabId
262259
val quickActionParams = node.params ?: error("empty payload")
263260
val partialResultToken = chatCommunicationManager.addPartialChatMessage(tabId)
264-
chatCommunicationManager.registerPartialResultToken(partialResultToken)
265261
var encryptionManager: JwtEncryptionManager? = null
266262
val result = AmazonQLspService.executeAsyncIfRunning(project) { server ->
267263
encryptionManager = this.encryptionManager
@@ -595,30 +591,13 @@ class BrowserConnector(
595591
chatCommunicationManager.removeInflightRequestForTab(tabId)
596592
} catch (e: CancellationException) {
597593
LOG.warn { "Cancelled chat generation" }
598-
try {
599-
chatAsyncResultManager.createRequestId(partialResultToken)
600-
chatAsyncResultManager.getResult(partialResultToken)
601-
handleCancellation(tabId, browser)
602-
} catch (ex: Exception) {
603-
LOG.warn(ex) { "An error occurred while processing cancellation" }
604-
} finally {
605-
chatAsyncResultManager.removeRequestId(partialResultToken)
606-
chatCommunicationManager.removePartialResultLock(partialResultToken)
607-
chatCommunicationManager.removeFinalResultProcessed(partialResultToken)
608-
}
609594
} catch (e: Exception) {
610595
LOG.warn(e) { "Failed to send chat message" }
611596
browser.postChat(chatCommunicationManager.getErrorUiMessage(tabId, e, partialResultToken))
612597
}
613598
}
614599
}
615600

616-
private fun handleCancellation(tabId: String, browser: Browser) {
617-
// Send a message to hide the stop button without showing an error
618-
val cancelMessage = chatCommunicationManager.getCancellationUiMessage(tabId)
619-
browser.postChat(cancelMessage)
620-
}
621-
622601
private fun updateQuickActionsInBrowser(browser: Browser) {
623602
val isFeatureDevAvailable = isFeatureDevAvailable(project)
624603
val isCodeTransformAvailable = isCodeTransformAvailable(project)

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
@@ -8,7 +8,7 @@ import com.intellij.openapi.project.Project
88
import kotlinx.coroutines.flow.MutableSharedFlow
99
import kotlinx.coroutines.flow.asSharedFlow
1010
import kotlinx.coroutines.runBlocking
11-
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AsyncChatUiListener
11+
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.ChatCommunicationManager
1212
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.FlareUiMessage
1313
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.GENERIC_COMMAND
1414
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.GenericCommandParams
@@ -40,7 +40,7 @@ class ActionRegistrar {
4040
val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU)
4141
uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params)
4242
}
43-
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
43+
ChatCommunicationManager.getInstance(project).notifyUi(uiMessage)
4444
}
4545
}
4646
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import com.intellij.openapi.actionSystem.DataKey
1111
import com.intellij.openapi.application.ApplicationManager
1212
import com.intellij.openapi.project.DumbAware
1313
import kotlinx.coroutines.runBlocking
14-
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AsyncChatUiListener
14+
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.ChatCommunicationManager
1515
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.FlareUiMessage
1616
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.ChatPrompt
1717
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SEND_TO_PROMPT
@@ -58,7 +58,8 @@ class ExplainCodeIssueAction : AnAction(), DumbAware {
5858
)
5959

6060
val uiMessage = FlareUiMessage(SEND_TO_PROMPT, params)
61-
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
61+
ChatCommunicationManager.getInstance(project).notifyUi(uiMessage)
62+
// AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
6263
}
6364
}
6465
}

plugins/amazonq/codetransform/jetbrains-community/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ tasks.prepareTestSandbox {
3232
val pluginXmlJar = project(":plugin-amazonq").tasks.jar
3333

3434
dependsOn(pluginXmlJar)
35-
intoChild(intellijPlatform.projectName.map { "$it/lib" })
36-
.from(pluginXmlJar)
35+
from(pluginXmlJar) {
36+
into(intellijPlatform.projectName.map { "$it/lib" })
37+
}
3738
}

plugins/amazonq/codewhisperer/jetbrains-community/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ tasks.prepareTestSandbox {
3131
val pluginXmlJar = project(":plugin-amazonq").tasks.jar
3232

3333
dependsOn(pluginXmlJar)
34-
intoChild(intellijPlatform.projectName.map { "$it/lib" })
35-
.from(pluginXmlJar)
34+
from(pluginXmlJar) {
35+
into(intellijPlatform.projectName.map { "$it/lib" })
36+
}
3637
}

plugins/amazonq/codewhisperer/jetbrains-ultimate/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ tasks.prepareTestSandbox {
3131
val pluginXmlJar = project(":plugin-amazonq").tasks.jar
3232

3333
dependsOn(pluginXmlJar)
34-
intoChild(intellijPlatform.projectName.map { "$it/lib" })
35-
.from(pluginXmlJar)
34+
from(pluginXmlJar) {
35+
into(intellijPlatform.projectName.map { "$it/lib" })
36+
}
3637
}

0 commit comments

Comments
 (0)