[BUG] @ file picker does not respect nested .gitignore files

Resolved 💬 3 comments Opened Feb 20, 2026 by alnoki Closed Mar 20, 2026

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. Running
git 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

  1. Create a repo with a nested .gitignore in a subdirectory

(e.g., examples/.gitignore containing target).

  1. Generate build artifacts that match the pattern

(e.g., examples/foo/target/).

  1. Open the VSCode extension and type @ to open the file picker.
  2. 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗