.cursorignore not being used

I’ve set up my .cursorignore file to include the .env file where my secrets are stored, but it seems like they’re still being passed in the chat

Some text was selected in the .env file, but in my understanding, the .cursorignore file should still be respected. Anything I’m doing wrong here?

Hi @xoel ,

Out of interest, did you have the .env file open and ‘in focus’ when you started the chat?

In Cursor Settings > Features > Chat there is a setting named:

  • Default no context (Submit chat with no context by default)

When that is toggled ON, chat does not select the open/focused file by default.

When it is toggled OFF, chat does select the open/focused file by default.

It displays Will Use: Current file in relation to the ‘open and focused’ file.

I was able to replicate the first part of what you saw, ie:

  • Default no context is OFF
  • The open and focused file is .env
  • I can see it says Will Use .env Current File

But I haven’t started a chat with it in those conditions.

Would be interesting to know what the expected behaviour is in the scenario when a file is ignored (via .cursorignore or .gitignore), but it is also open and focused when starting a chat and default no context is turned off.

It would also be interesting to know what the expected behaviour is if you @ an ignored file in a chat - I can see that .env shows in the @ dropdown, but I haven’t tested what happens if you actually choose it. (I don’t really want to do that :slight_smile: ).

Also, I am assuming you don’t have a .gitignore file, that’s why you added the .env entry to the .cursorignore file? I am pretty sure Cursor respects the .gitignore file first, and the .cursorignore file is in addition to what is ignored by the .gitignore.

1 Like

I have been experimenting with this as well. I mentioned in the slowing down chat that it is crucial to have this set up perfectly for Cursor to do it’s thing the fastest and smoothest way possible. In the next week or so I am going to take Cursor apart and take a look and see if there is anything i can do to speed it up, but it would be great to have some optimal build in functions schemas that make Cursor really fly right out of the box for new users.

Hi there,

I had both .gitignore and .cursorignore, the .env was focused and I had Default no context set to OFF

I also added my .env files to the .cursorignore file, but still, when I edit a .env file cursor still does auto completion suggestions. This let’s me believe it has access to this file. How can I exclude file for any operation in cursor as if the file would not exist? This is crucial to me, as some files might contain secrets that should never leave my machine.

This is a potentially serious security issue. We need an answer from Cursor on this. It should be possible to fully exclude files from indexing and auto-complete suggestions from Cursor Tab.

1 Like