Skip to content

Commit 21eee6e

Browse files
committed
fix tab acceptAction not working in JB remote
1 parent 3d9586d commit 21eee6e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/popup/CodeWhispererPopupManager.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.intellij.codeInsight.lookup.LookupManagerListener
99
import com.intellij.idea.AppMode
1010
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EDITOR_ENTER
1111
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EDITOR_ESCAPE
12+
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EDITOR_TAB
1213
import com.intellij.openapi.application.ApplicationManager
1314
import com.intellij.openapi.command.WriteCommandAction
1415
import com.intellij.openapi.components.Service
@@ -59,6 +60,7 @@ import software.aws.toolkits.jetbrains.services.codewhisperer.model.SessionConte
5960
import software.aws.toolkits.jetbrains.services.codewhisperer.popup.handlers.CodeWhispererEditorActionHandler
6061
import software.aws.toolkits.jetbrains.services.codewhisperer.popup.handlers.CodeWhispererPopupEnterHandler
6162
import software.aws.toolkits.jetbrains.services.codewhisperer.popup.handlers.CodeWhispererPopupEscHandler
63+
import software.aws.toolkits.jetbrains.services.codewhisperer.popup.handlers.CodeWhispererPopupTabHandler
6264
import software.aws.toolkits.jetbrains.services.codewhisperer.popup.handlers.CodeWhispererPopupTypedHandler
6365
import software.aws.toolkits.jetbrains.services.codewhisperer.popup.listeners.CodeWhispererAcceptButtonActionListener
6466
import software.aws.toolkits.jetbrains.services.codewhisperer.popup.listeners.CodeWhispererActionListener
@@ -483,6 +485,10 @@ class CodeWhispererPopupManager {
483485
ACTION_EDITOR_ENTER,
484486
CodeWhispererPopupEnterHandler(EditorActionManager.getInstance().getActionHandler(ACTION_EDITOR_ENTER), states)
485487
)
488+
489+
if (AppMode.isRemoteDevHost()) {
490+
setPopupActionHandler(ACTION_EDITOR_TAB, CodeWhispererPopupTabHandler(states))
491+
}
486492
}
487493

488494
private fun setPopupTypedHandler(newHandler: CodeWhispererPopupTypedHandler) {

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/popup/handlers/CodeWhispererPopupTabHandler.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import com.intellij.openapi.editor.Caret
99
import com.intellij.openapi.editor.Editor
1010
import software.aws.toolkits.jetbrains.services.codewhisperer.model.InvocationContext
1111
import software.aws.toolkits.jetbrains.services.codewhisperer.popup.CodeWhispererPopupManager
12+
import software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererInvocationStatus
1213

1314
class CodeWhispererPopupTabHandler(states: InvocationContext) : CodeWhispererEditorActionHandler(states) {
1415
override fun doExecute(editor: Editor, caret: Caret?, dataContext: DataContext?) {
16+
if (!CodeWhispererInvocationStatus.getInstance().isDisplaySessionActive()) return
1517
ApplicationManager.getApplication().messageBus.syncPublisher(
1618
CodeWhispererPopupManager.CODEWHISPERER_USER_ACTION_PERFORMED
1719
).beforeAccept(states, CodeWhispererPopupManager.getInstance().sessionContext)

0 commit comments

Comments
 (0)