[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:
<img width="662" height="404" alt="Image" src="https://github.com/user-attachments/assets/d537a953-23b8-4ad4-a6e4-4045f5648650" />
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:
<img width="362" height="186" alt="Image" src="https://github.com/user-attachments/assets/72e4b1a5-d6ce-45bd-a010-f8c7e7ad809a" />
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_
10 Comments
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:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Does this work for your
.gitignoreor is it just this special.gitignore_globalfile? Can you check what yourClaude Code: Do Not Exclude Search Patternssetting is?The vscode extension does correctly exclude items listed in
.gitignore. MyClaude Code: Do Not Exclude Search Patternssetting is unchecked (the default).If supporting
core.excludesFilegit setting becomes an option y'all want to support, I also propose looking for.gitignorefiles in parent directories and reading those. That would be another way to have developer-environment-specific files that need to be ignoredThis 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.
i will add a check for
core.excludesFile. we normally look for the global git ignore in.config/git/ignorebut we just didn't respect when folks have another value forcore.excludesFile. should be available in a release later this week or early next week!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.
Was this released? Please first release, place the comment in the changelog linking to this issue, and then consider adding a note to this issue.
Nevertheless, this issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
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.