Skip to content

Commit f8bfc15

Browse files
committed
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.
1 parent c765d61 commit f8bfc15

File tree

1 file changed

+7
-3
lines changed
  • plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service

1 file changed

+7
-3
lines changed

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+
val it = CodeWhispererPopupManager.getInstance().initPopup()
213+
Disposer.register(it) { CodeWhispererInvocationStatus.getInstance().finishInvocation() }
214+
it
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)