claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

BUG/FEATURE-REQUEST: `@`-Mention Limitation for Gitignored Files in VS Code

Open hesreallyhim opened this issue 10 months ago • 3 comments

Bug Description It seems as though I am unable to "@"-mention a file (in VS-Code) in my repo/project-directory if that file is gitignored - and I don't see any configuration or option to change this behavior.

Environment Info

  • Platform: macos
  • Terminal: vscode
  • Version: 1.0.2
  • Feedback ID: 77487e95-dde8-4f6b-9251-3c48231594f4

Errors N/A

hesreallyhim avatar May 23 '25 02:05 hesreallyhim

Thanks for the report! The auto-complete for at-mention does not include the .gitignore files for now. If you're using the VS Code extension, you can use Cmd+Option+K to at-mention the selected file in the IDE in Claude.

hackyon-anthropic avatar May 23 '25 13:05 hackyon-anthropic

As a specific use-case of why this would be nice, I often want to add doc files for libraries or whatnot just for Claude in my local copy of the repo, but I don't want to commit them to the actual repository. Gitignore is doing double duty, really, of files to ignore for git and files to ignore for processing by Claude. Those aren't always the same, even just for JS you might want it to look at your node_modules files some of the time even if they aren't always relevant.

MinusGix avatar May 28 '25 18:05 MinusGix

@MinusGix to play the other side, this is like a minor convenience thing, it's not that Claude is not able to read those files, you just can't mention them with a magic command...

EDIT: Looks like they added it to the roadmap, so just give it some time. :)

hesreallyhim avatar May 28 '25 19:05 hesreallyhim

This 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.

github-actions[bot] avatar Oct 10 '25 10:10 github-actions[bot]

I'm experiencing this same limitation with my personal AI system (I have built a personal operating system built on Obsidian with Claude Code integration for AI-assisted workflows).

I intentionally gitignore sensitive folders (me/private/, tasks/, journal/, knowledge/private/) to keep personal data out of version control, but I need to be able to @-mention theses files when working with Claude Code on my personal account.

Current Workaround: None really, I have to manually type the full path. It's painful and error prone, and creates a lot of additional confirmation cycles (did CC get the right file).

Ideal Solution: A configuration option in .claude/settings.json or .claude/settings.local.json to override gitignore for specific paths such as:

  {
    "fileVisibility": {
      "ignoreGitignoreFor": ["me/private/**", "tasks/**", "journal/**"]
    }
  }

Or perhaps less Git specific and just allow explicit include paths:

  {
    "fileVisibility": {
      "add": ["me/private/**", "tasks/**", "journal/**"]
    }
  }

This would allow teams to share .claude/settings.json with standard gitignore behavior, while individual users could use .claude/settings.local.json (which is itself gitignored) to expose sensitive files only on their local machine.

mattheworiordan avatar Nov 14 '25 09:11 mattheworiordan

This is now doable in the terminal as well as through the VSCode extension through: https://github.com/anthropics/claude-code/issues/5105#issuecomment-3486176426

hackyon-anthropic avatar Nov 14 '25 12:11 hackyon-anthropic