[BUG] VSCode Extension Does Not Respect .gitignore_global When Linking Files With @
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?
When using the VSCode extension, trying to add files as context with @ looks up files that are in my .gitignore_global config:
When I try the same in claude code in the terminal I do not get this issue (.gitignore_global is respected). This is in the same repo for both:
What Should Happen?
Claude should respect my .gitignore_global when adding files to the context with @ from both the terminal and VSCode extensions
Error Messages/Logs
Steps to Reproduce
- Create
~/.gitignore_global, add files to it, and set that as global withgit config --global core.excludesFile ~/.gitignore_global - Create files that are ignored (in my case it is files created by the local history extension)
- Start a chat with
cmd+escin VSCode, using the extension UI (not terminal UI) - Add a file with
@and see that the extension suggests files that are gitignored
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.0.27 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response
I don't have the ability to reopen https://github.com/anthropics/claude-code/issues/10213 so filed a new issue
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/10213
- https://github.com/anthropics/claude-code/issues/1248
- https://github.com/anthropics/claude-code/issues/8481
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
Does this work for your .gitignore or is it just this special .gitignore_global file? Can you check what your Claude Code: Do Not Exclude Search Patterns setting is?
The vscode extension does correctly exclude items listed in .gitignore. My Claude Code: Do Not Exclude Search Patterns setting is unchecked (the default).
If supporting core.excludesFile git setting becomes an option y'all want to support, I also propose looking for .gitignore files in parent directories and reading those. That would be another way to have developer-environment-specific files that need to be ignored
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.