[BUG] @ file picker does not respect nested .gitignore files
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
The @ file picker in the VSCode extension does not respect.gitignore files in subdirectories. Only the root .gitignore
appears to be honored.
For example, in a monorepo with this structure:
.gitignore # ignores .DS_Store, .vscode/, deploy/*
examples/.gitignore # ignores target
examples/tree/.gitignore # ignores deploy/*
Files under examples/*/target/ (Rust build artifacts — .o, .d,.so, ELF binaries, etc.) still appear in the @ autocomplete
despite being covered by examples/.gitignore. Runninggit ls-files --others --ignored --exclude-standard correctly
identifies these as ignored, and git status does not show them.
It appears the file picker may only read the root .gitignore and
not traverse nested ones, or it may be using a simplified ignore
implementation rather than Git's own logic.
What Should Happen?
The @ file picker should respect all .gitignore files in the
repository hierarchy, matching Git's own behavior. Files ignored by
any .gitignore at any level should not appear in autocomplete.
Steps to Reproduce
- Create a repo with a nested
.gitignorein a subdirectory
(e.g., examples/.gitignore containing target).
- Generate build artifacts that match the pattern
(e.g., examples/foo/target/).
- Open the VSCode extension and type
@to open the file picker. - Search for a file inside the ignored directory — it appears in
suggestions despite being gitignored.
Claude Code Version
v2.1.47
Platform
Anthropic API
Operating System
macOS (Darwin 24.6.0)
Terminal/Shell
VSCode integrated terminal
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗