[BUG] VS Code extension, Option+K insert @-mention is inserted in the wrong place (not where the cursor is)

Status Fixed / completed
Maintainer reply ✓ Yes — hackyon-anthropic
Activity 6 comments · opened Oct 3, 2025 · closed Dec 5, 2025
💡 Likely answer: A maintainer (hackyon-anthropic, collaborator) responded on this thread — see the highlighted reply below.

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
  1. Add a file @-mention using Option+k shortcut
  2. 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

View original on GitHub ↗

6 Comments

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/2130
  2. https://github.com/anthropics/claude-code/issues/8225
  3. https://github.com/anthropics/claude-code/issues/5247

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

hugoblanc · 10 months ago

Same here; that makes me use the old terminal mode.

josefguenther · 9 months ago

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:

so @yourfile mething here
hi
hackyon-anthropic collaborator · 9 months ago

Just submitted a fix, should be out in a few days!

danmana · 8 months ago

Seems to be fixed in the current version, thanks

github-actions[bot] · 8 months ago

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.