Cursor ignoring certain directories for file searching?

Does Cursor ignore certain directories for suggesting files through the search box that appears when you press CMD + SHIFT + O on a Mac (not sure what the real name is) or when doing “@typing_continues_here” in the agent chat window?

I have a project in PHP, which has all of the library files installed into the vendor directory.

The other day Cursor decided to write a new class, instead of using one that already existed in a library. I tried to tell the agent to use the file from the library, and it was only after I had opened the file in an editor window, that the autocomplete would autocomplete the file name.

Attached is a screenshot of Cursor not being able to find the file.

Hi Dan,
Based on your screenshot, it looks like you’re using Quick Open (Cmd+P) rather than Cmd+Shift+O (which is “Go to Symbol in Editor” for the current file). Just flagging that in case it helps with shortcuts.

The most likely issue is that your project has vendor/ in .gitignore (common for PHP/Composer setups). Cursor respects .gitignore during indexing, so anything under ignored directories is excluded from:

  • @ file autocomplete in agent chat

  • The agent’s file search tools (glob/grep)

  • Codebase indexing and semantic search

That’s why the agent couldn’t find the existing library class and generated a new one—it simply doesn’t see anything inside vendor/.

Quick Open (Cmd+P) also appears to follow these exclusions in Cursor, even though the files are visible in the Explorer. This differs from standard VS Code, where gitignored files typically still show up in Quick Open.

As you noticed, opening the file in a tab makes it immediately available in search and @ autocomplete—open files bypass these exclusions.

There is a potential workaround using .cursorignore with !vendor/, but it’s not fully reliable—negation patterns don’t consistently override .gitignore. There’s an open issue tracking this.

Could you confirm whether vendor/ is listed in your .gitignore? That would help confirm the root cause.

Hi Mohit,

Thanks for the response.

Yes, my vendor/ directory is in .gitinore and so probably this is expected behaviour.

I tried your suggestion of putting !vendor/in the .cursorignore but can confirm, it appears to not work.

I have a workaround of symlinking vendor_src/ to the vendor/ directory, and then adding vendor_src/ to my global gitconfig ignore file, which Cursor seems to not parse. The end result is that the files in the vendor directory are suggested in the various places where Cursor presents a list of suggested files, but i’m not in danger of accidentally committing vendor’ files.

Based on your screenshot, it looks like you’re using

I had edited out the @ symbol. And uh, didn’t actually know that Command + P was a thing.

cheers
Dan
Ack