[Feature Request] Allow custom slash commands access the selected lines in the IDE
Status Closed — not planned
Maintainer reply None cached
Activity 8 comments · opened Aug 31, 2025 · closed Jan 9, 2026
With /ide active, Claude Code has access to the selected lines within the IDE. This is great for running actions on a narrow scope. Unfortunately, custom slash commands do not have access to the selected lines as it looks. Please provide something like $SELECTION inside custom slash commands so that one can e.g. create an elaborated "/explain" command which not just can be used like "/explain @file" or "/explain whatever else", but also just as "/explain" and then it would pick up the selected lines. For this it internally just references $ARGUMENTS $SELECTION for its context.
8 Comments
Absolutely agree!
There is a similar issue with the VSCode extension itself, and it's even more confusing from a UI perspective.
<img width="590" height="171" alt="Image" src="https://github.com/user-attachments/assets/650a9f7a-7e49-4e1d-9db6-351913ea105e" />
The prompt shows that I have 3 lines selected (or if it's a saved file the file name and selection). If I type a prompt, it'll include it in the context. But if I use a slash command (similar to the Op's
/explainabove), the IDE context is not included.This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
The issue still persists.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
The issue still persists. And it would be such simple to implement (just expose the already known selection with a variable to the slash commands) and is obviously useful that I do not understand why this isn't just realized.
Seems like the bot has a bug and auto-closed this. There was clearly activity by @rse on Dec 8th, which is activity within 60 days but was ignored in the checks. Seems to be pretty endemic with Claude in general. They probably vibe-coded the github actions, and trusted it was right.
I'd say just resubmit the issue every time it's auto-closed until it's actually resolved or someone from Claude actually responds with a comment that they won't do it.
I've put in and mentioned this issue via my company to try and get it fixed via the corporate channels.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.