@-mention file picker shows node_modules in pnpm workspaces despite .gitignore exclusion
Summary
The @ file mention picker in Claude Code does not filter out node_modules/ directories in pnpm workspace repos, even though they are excluded by .gitignore.
Steps to Reproduce
- Open a pnpm workspace repository (multiple packages under
packages/) - Root
.gitignorecontainsnode_modules/(matches all nestednode_modulesdirectories per git semantics) - Type
@in the Claude Code prompt to open the file picker - Observe
node_modules/directories appearing in picker results (at root and/or inside packages/)
Expected Behavior
The file picker should apply .gitignore rules the same way git does — node_modules/ in the root .gitignore excludes all nested node_modules/ directories, and none of them should appear in the picker.
Actual Behavior
Nested node_modules/ directories (e.g. packages/foo/node_modules/) appear in the @ file picker even though the root .gitignore contains node_modules/.
Environment
- OS: macOS (Darwin 25.3.0)
- Repo structure: pnpm workspace (
packages/with multiple sub-packages, each with their ownnode_modules/) respectGitignoresetting: not set (defaults totrue)- No project-level
settings.jsonoverrides
Notes
The root .gitignore entry node_modules/ is valid git syntax that matches nested directories. git status and git ls-files correctly exclude them. The file picker appears to only check the root-level .gitignore against root-level paths, missing nested matches.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗