VS Code: File attachment persists from file explorer click even when file is not open
Status Fixed / completed
Maintainer reply None cached
Activity 5 comments · opened Mar 18, 2026 · closed Apr 8, 2026
Bug Description
After updating the Claude Code VS Code extension today (2026-03-18), a new file attachment indicator appears below the chat input. This indicator shows a filename that was clicked in the file explorer, even after navigating away from that file. The file remains "attached" to the conversation context without the user explicitly attaching it.
Steps to Reproduce
- Open a file in the file explorer (single click or browse)
- Navigate to a different tab or the Settings panel
- Observe the chat input still shows the previously clicked file as an attachment
Expected Behavior
Either:
- The attachment should only show the currently active editor tab, OR
- The attachment should be cleared when the user navigates away from the file, OR
- The file should only be attached via an explicit action (Shift+drag, @-mention, or a button)
Actual Behavior
The file persists as an attachment after a single interaction (click/open in explorer), even when the user is no longer viewing that file. This is confusing because it's unclear why a specific file is being sent as context.
Environment
- VS Code extension updated: 2026-03-18 (latest)
- OS: macOS (Darwin 25.3.0)
5 Comments
This is also now happening to me in Cursor, unfortunately my search didn't find this pre-existing issue before I opened this one https://github.com/anthropics/claude-code/issues/38301.
<img width="605" height="144" alt="Image" src="https://github.com/user-attachments/assets/5232c487-f902-4228-bfd1-03f3b4dc0fca" />
<img width="651" height="144" alt="Image" src="https://github.com/user-attachments/assets/1eb20ad4-fabe-4380-b25f-e98e47e93e83" />
Same in vscode extension. All files are closed.
Same bug for me, it keeps adding 10000 lines files without consent to my context.
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.
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.