[BUG] JetBrains plugin: "Send to Claude Code" (Ctrl+Alt+K) does nothing when the Markdown preview pane is focused
Environment
- Claude Code JetBrains plugin: 0.1.14-beta
- IDE: IntelliJ IDEA 2025.3
- OS: macOS
Steps to reproduce
- Open a
.mdfile and switch to the Preview pane (or focus the preview side of the split view). - Select some text in the rendered preview.
- Trigger "Send to Claude Code" — via
Ctrl+Alt+K/Cmd+Option+K, the editor right-click menu, or the floating code toolbar.
Expected: the selection (or at least an @File reference) is sent to Claude Code and the terminal is focused.
Actual: nothing happens. The action is greyed out / absent, and the shortcut is a no-op. It only works when a text editor is focused.
Note: the "file reference shortcut"Cmd+Option+K/Ctrl+Alt+Kdescribed in the docs is the same action asSend to Claude Code(there is only one action bound to that keystroke), so it is not a separate escape hatch — it fails from the preview for the same reason.
Root cause
Send to Claude Code (com.anthropic.code.plugin.actions.SendToClaudeAction) is bound entirely to the text Editor:
- Registered in
EditorPopupMenu+Floating.CodeToolbarwith shortcutCtrl+Alt+K(Cmd+Option+Kon macOS). update()enables it only whene.getData(CommonDataKeys.EDITOR) != null(and Claude is connected).actionPerformed()readseditor = e.getData(CommonDataKeys.EDITOR)and callssendAtMentionedNotifications(mcp, editor)→NotificationManager.sendAtMentionedNotification(Editor), which builds the@File#Lx-Lyat-mention fromeditor.getSelectionModel(), then focuses Claude in the terminal.
The Markdown preview is a JCEF pane (MarkdownJCEFHtmlPanel) — a FileEditor, but not a TextEditor, so CommonDataKeys.EDITOR is null in its data context. The action is therefore disabled/invisible in the preview and the shortcut does nothing. The same happens for any .md opened in preview-only mode.
Proposed fix
Don't require CommonDataKeys.EDITOR. When it's null, resolve the underlying text editor from the active FileEditor:
- If the selected editor is a
TextEditorWithPreview(the standard Markdown split editor), use its embeddedgetTextEditor().getEditor(); otherwise fall back toFileEditorManager.getInstance(project).getSelectedEditor()'s text editor. - Then send an
@Fileat-mention for that file — using the source selection if there is one, or a whole-file@Filereference otherwise. This makes the action / shortcut / menu item work from the preview.
Optionally, to honor what was actually highlighted in the preview, read the JCEF DOM selection via JBCefJSQuery (window.getSelection().toString()) and send it as the at-mention text (best-effort; no line range). Also worth registering the action in the Markdown preview's context-menu group so it isn't invisible there.
Workaround (today)
Don't rely on the action/shortcut from the preview (it's the broken path). Instead:
- Select the text in the source editor (split-view left pane / "Editor only" mode) — the selection is then shared automatically (
⧉ Selected N lines from <file>), no shortcut needed; or - Copy the text and paste it into the Claude prompt manually.