Skip to content

Commit 5a8faae

Browse files
committed
patch for aws#5076
1 parent 2032a57 commit 5a8faae

File tree

1 file changed

+8
-2
lines changed
  • plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/inline

1 file changed

+8
-2
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/inline/OpenChatInputAction.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33

44
package software.aws.toolkits.jetbrains.services.cwc.inline
55

6-
import com.intellij.execution.impl.ConsoleViewImpl
76
import com.intellij.openapi.actionSystem.AnAction
87
import com.intellij.openapi.actionSystem.AnActionEvent
98
import com.intellij.openapi.actionSystem.CommonDataKeys
9+
import com.intellij.openapi.util.Key
1010

1111
class OpenChatInputAction : AnAction() {
1212
override fun actionPerformed(e: AnActionEvent) {
1313
val editor = e.getData(CommonDataKeys.EDITOR) ?: return
14-
val isConsole = editor.document.getUserData(ConsoleViewImpl.IS_CONSOLE_DOCUMENT)
14+
// this is a hack since this key does not exist in 233
15+
// TODO: change below to use ConsoleViewImpl.IS_CONSOLE_DOCUMENT after 233 support is removed
16+
var isConsole: Any? = null
17+
val key: Key<*>? = Key.findKeyByName("IS_CONSOLE_DOCUMENT")
18+
if (key != null) {
19+
isConsole = editor.document.getUserData(key)
20+
}
1521
if (isConsole == true) return
1622
if (!editor.document.isWritable) return
1723
val project = editor.project ?: return

0 commit comments

Comments
 (0)