diff --git a/.changes/next-release/bugfix-eb803511-b66c-454e-a832-ca189572d1af.json b/.changes/next-release/bugfix-eb803511-b66c-454e-a832-ca189572d1af.json new file mode 100644 index 00000000000..dfba779804a --- /dev/null +++ b/.changes/next-release/bugfix-eb803511-b66c-454e-a832-ca189572d1af.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Fixed an issue where Q inline won't appear in JetBrains remote 2024.2+" +} \ No newline at end of file diff --git a/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt b/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt index d6189566d1a..d5c7d770106 100644 --- a/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt +++ b/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt @@ -46,6 +46,7 @@ import software.aws.toolkits.core.utils.debug import software.aws.toolkits.core.utils.getLogger import software.aws.toolkits.core.utils.info import software.aws.toolkits.core.utils.warn +import software.aws.toolkits.jetbrains.core.coroutines.EDT import software.aws.toolkits.jetbrains.core.coroutines.disposableCoroutineScope import software.aws.toolkits.jetbrains.core.coroutines.getCoroutineBgContext import software.aws.toolkits.jetbrains.core.coroutines.projectCoroutineScope @@ -206,9 +207,12 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable { invokeCodeWhispererInBackground(requestContext) } - internal fun invokeCodeWhispererInBackground(requestContext: RequestContext): Job { - val popup = CodeWhispererPopupManager.getInstance().initPopup() - Disposer.register(popup) { CodeWhispererInvocationStatus.getInstance().finishInvocation() } + internal suspend fun invokeCodeWhispererInBackground(requestContext: RequestContext): Job { + val popup = withContext(EDT) { + CodeWhispererPopupManager.getInstance().initPopup().also { + Disposer.register(it) { CodeWhispererInvocationStatus.getInstance().finishInvocation() } + } + } val workerContexts = mutableListOf() // When popup is disposed we will cancel this coroutine. The only places popup can get disposed should be