Skip to content

Commit 0f1e099

Browse files
andrewyuqrli
andauthored
Fix popup not init in EDT for remote (#5045)
* Fix popup not init in EDT for remote 1. BackendComponentBePopupBuilder.createPopup somehow needs to be executed in EDT while recent changes made our initPopup() to happen in BGT. * Update plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt Co-authored-by: Richard Li <[email protected]> * change log --------- Co-authored-by: Richard Li <[email protected]>
1 parent 7f3b222 commit 0f1e099

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fixed an issue where Q inline won't appear in JetBrains remote 2024.2+"
4+
}

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import software.aws.toolkits.core.utils.debug
4646
import software.aws.toolkits.core.utils.getLogger
4747
import software.aws.toolkits.core.utils.info
4848
import software.aws.toolkits.core.utils.warn
49+
import software.aws.toolkits.jetbrains.core.coroutines.EDT
4950
import software.aws.toolkits.jetbrains.core.coroutines.disposableCoroutineScope
5051
import software.aws.toolkits.jetbrains.core.coroutines.getCoroutineBgContext
5152
import software.aws.toolkits.jetbrains.core.coroutines.projectCoroutineScope
@@ -206,9 +207,12 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable {
206207
invokeCodeWhispererInBackground(requestContext)
207208
}
208209

209-
internal fun invokeCodeWhispererInBackground(requestContext: RequestContext): Job {
210-
val popup = CodeWhispererPopupManager.getInstance().initPopup()
211-
Disposer.register(popup) { CodeWhispererInvocationStatus.getInstance().finishInvocation() }
210+
internal suspend fun invokeCodeWhispererInBackground(requestContext: RequestContext): Job {
211+
val popup = withContext(EDT) {
212+
CodeWhispererPopupManager.getInstance().initPopup().also {
213+
Disposer.register(it) { CodeWhispererInvocationStatus.getInstance().finishInvocation() }
214+
}
215+
}
212216

213217
val workerContexts = mutableListOf<WorkerContext>()
214218
// When popup is disposed we will cancel this coroutine. The only places popup can get disposed should be

0 commit comments

Comments
 (0)