[FEATURE] Desktop file pane: send the current text selection to the prompt, like Option+K in the VS Code extension
What I want
In the desktop app's Code tab, I'd like to select text inside the file pane and send just that
selection to the prompt — ideally with a keyboard shortcut that inserts a line-range reference,
the way Option+K works in the VS Code extension.
Current behavior
Selecting text in the file pane and choosing Attach as context from the right-click menu attaches
the entire file, not the selection. The prompt receives an @path/to/file.md reference and Claude
reads the whole file. Nothing about the selected range reaches the model.
The neighbouring menu item is labelled Copy file contents (not "Copy selection"), so the whole
context menu appears to be file-scoped by design rather than this being a bug.
Note: this already exists elsewhere in the app
The chat transcript's right-click menu already has Attach selection as context, and it is
selection-scoped (see #61484, #82344). The file pane's menu only offers file-scoped
Attach as context / Copy file contents / Copy path. This request is for parity:
bring the existing selection-scoped attach to the file pane.
Why it matters
When asking for a small edit inside a long document, there is no way to point at a region other than
describing it in prose. On a 500-line Markdown file this means either:
- pasting the passage into the prompt, which duplicates the text in context, or
- describing the location ("the third row of table C", "line 47"), which is imprecise and costs a
round trip when the description is ambiguous.
The VS Code extension already solves this: the current selection is shared automatically, the prompt
footer shows how many lines are selected, there is an eye-slash toggle to hide it, and Option+K
inserts @file.ts#5-10. Having the same thing in the desktop app would let me stop switching editors
for small edits.
Proposed behavior
- A right-click item such as Attach selection as context when a selection exists in the file pane.
- A keyboard shortcut that inserts a line-range mention (
@path/to/file.md#L12-L18) into the prompt. - Optionally, mirror the VS Code extension's automatic selection sharing with a visible on/off toggle,
so the behavior is predictable and can be turned off for sensitive files.
Workarounds I tried
- Copy and paste the passage into the prompt. Works, but if the file pane is in rendered preview
mode the Markdown syntax (backticks, bold, links) is stripped, so the pasted text no longer matches
the file byte-for-byte. Copying from "View source" mode preserves it, but that is an extra step to
remember.
- Custom keybindings.
~/.claude/keybindings.jsoncannot express this. Its contexts (Chat,
Transcript, DiffDialog, Scroll, …) are terminal-UI components, and no action targets the
desktop file pane. selection:copy applies to the conversation view in fullscreen rendering, not to
the file pane.
Environment
- Claude Desktop 1.26832.0
- macOS 15 (Darwin 25.6.0), Apple Silicon
- Local session, Code tab
Related
- #61484, #82344, #76747 — selection-scoped actions in the transcript context menu
- #53519 — other file-pane gaps (symlinks, binary files)
- Docs: https://code.claude.com/docs/en/desktop (Arrange your workspace → Open and edit files)
- Docs: https://code.claude.com/docs/en/ide-integrations (selection sharing and
Option+Kin VS Code) - Docs: https://code.claude.com/docs/en/keybindings (available contexts and actions)