Is it possible to index a file that's in my .gitignore?

I have a Typescript project. All node_modules are in my .gitignore

Some of the node_module dependencies have types I’d like to be able to have indexed and made available when interacting with the LLM.

Is it possible to add explicit overrides? Currently I have a workspace where the two root directories are my project and the dependency, but it’s a far from ideal workflow since some VSCode configs that I have in my project assume a base directory that is my project and not a parent directory.

You can add !path/to/folder to your .cursorignore to make sure the folder gets included even if it’s ignored by gitignore. Note that you may need to add !path/to/folder/* or !path/to/folder/**/* (see this SO answer for more details).

Thanks for the reply @arvid220u

I’m unable to verify whether this is working. I’ve opened a related topic since I’m unable to get Symbols to work for code in my node_modules

@arvid220u I tried doing this a different way and while I got Cursor to index the files in a dir that’s in my .gitignore, I’m unable to get the symbols to show up.

I created a ./tmp dir in my project that’s ignored by git and copied a dependency that’s in my ./node_modules into ./tmp. After I configured my .cursorignore to add negations for the ./tmp dir, resyncing the index resulted in the files in ./tmp being picked up.

I’m still unable to get anything that’s in tmp as an @ Symbol.

However, when I comment out the tmp dir in .gitignore, I’m able to use the @ Symbols! It looks as if Cursor has a blocklist for all files covered in .gitignore when it comes to @ Symbols, even if .cursorignore negates them and allows them to be indexed . Can you confirm this is the case? If so, can we update Cursor to respect the negated files in .cursorignore?

This is indeed the case! @ symbols currently do not follow the cursorignore file.

They probably should! Requires some careful work on our end, though, so may take some time.

1 Like

Got it, thanks for the response!