[BUG] @-file autocomplete ignores gitignored files even when includeIgnoredFiles is configured

Resolved 💬 2 comments Opened Apr 4, 2026 by mulkatz Closed Apr 4, 2026

Preflight Checklist

  • [x] I searched existing issues and this specific bug (autocomplete inconsistency) is not reported
  • [x] This is a single bug report, not multiple issues
  • [x] I am using the latest version of Claude Code

What's Wrong?

The @-file autocomplete does not suggest gitignored files, making them unreachable via the file picker. This is inconsistent with how other tools in Claude Code handle ignored files:

| Component | Respects gitignored files? |
|-----------|---------------------------|
| Grep tool | ✅ Yes (with includeIgnoredFiles) |
| Glob tool | ❌ No (see #31769) |
| Read tool (direct path) | ✅ Yes |
| @-file autocomplete | ❌ No |

The @ picker appears to use a VCS-aware file index that silently excludes anything in .gitignore. This means files like .env.example, local caches, build outputs, and other gitignored-but-relevant files cannot be referenced via autocomplete at all — you have to know the exact path and type it manually, which defeats the purpose of the picker.

This is part of a broader pattern where gitignore exclusions leak into features where they shouldn't apply (see also #31769 for Glob and #29433 for VS Code selection context).

What Should Happen?

Gitignored files should appear in @-file autocomplete suggestions, consistent with how the Read tool and Grep tool (with includeIgnoredFiles) handle them. At minimum, the existing includeIgnoredFiles setting should apply to the @ picker as well.

Files being gitignored means "don't track in version control" — not "pretend they don't exist." Users frequently need to reference gitignored files in conversation (config files, caches, build artifacts, local test data).

Steps to Reproduce

  1. Have a file that is gitignored (e.g., .mulder-cache.db matched by .gitignore pattern *.db)
  2. In the Claude Code prompt, type @ and start typing the filename
  3. Observe: No autocomplete suggestion appears for the gitignored file
  4. Compare: Type the full path manually and Claude Code can read it without issues via the Read tool

Minimal reproduction:

mkdir /tmp/test-repo && cd /tmp/test-repo
git init
echo "secret.env" > .gitignore
echo "DB_HOST=localhost" > secret.env
echo "visible.txt" > visible.txt
git add -A && git commit -m "init"
# Now open Claude Code in this directory
# Type @ — visible.txt appears, secret.env does not

Is this a regression?

No, this never worked

Claude Code Version

2.1.92

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Error Messages/Logs

_No error messages — the file is silently excluded from autocomplete suggestions._

Claude Model

Opus

Last Working Version

_N/A — never worked_

Additional Information

Related issues:

  • #36647 — Filed as a feature request for the same symptom, but the root cause is an inconsistency (not a missing feature). The includeIgnoredFiles setting exists but doesn't apply uniformly.
  • #31769 — Same class of bug: includeIgnoredFiles respected by Grep but not Glob.
  • #29433 — VS Code extension also excludes gitignored files from selection context.
  • #40120 — Documentation gap around VCS exclusion behavior.

Suggested fix direction: The @-file picker's file index should respect the includeIgnoredFiles setting, same as the Grep tool does. Alternatively, gitignored files could always be included in autocomplete (with a visual indicator like dimmed text) since the picker is a local-only convenience feature with no security implications.

View original on GitHub ↗

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