[BUG] VS Code extension, Option+K insert @-mention is inserted in the wrong place (not where the cursor is)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
If the prompt is multi-line, the Option+k action (insert @-mention) inserts the file in the wrong place, not where the cursor is
Ex: in this case my cursor was at the end of the prompt, then I clicked in the file and pressed Option+K
Instead of adding the @-mention at the end of the prompt, it got inserted in the middle of it
<img width="1405" height="621" alt="Image" src="https://github.com/user-attachments/assets/fec65831-75d9-4325-bb0f-206cedf98ed7" />
https://github.com/user-attachments/assets/bcdea156-a1ab-4f6c-9612-86050efc645a
What Should Happen?
The @-mention should be inserted where the cursor is
Error Messages/Logs
Steps to Reproduce
1, Write a multi line prompt (using shift enter), leave the cursor at the end
lorem ipsum
dolor sit amet
- Add a file @-mention using Option+k shortcut
- The @-mention is added in the wrong place
lorem ipsum
do @claude-code-add-file.md lor sit amet
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.5
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Cursor
Additional Information
Cmd+Option+k to add in claude code terminal works as expected, only the vscode extension has the bug
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Same here; that makes me use the old terminal mode.
Also have this issue. It's the shift+enter that messes it up. Same for dragging in files.
I've found in my case it counts the characters in the line after shift+return, and injects it that many characters after the beginning of the whole message. Eg, if I say "test", it injects @myfile at character 4 from the beginning of the whole message -- not at character 4 of the last line.
Like this:
Just submitted a fix, should be out in a few days!
Seems to be fixed in the current version, thanks
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.