Loving the product, but it’s really lacking the ability to ignore specific sensitive files and directories. This is a pretty big drawback, since you never know if you aren’t accidentally going to include a file that should never be leaving the host.
I know that Cursor is supposed to ignore things that are present in .gitignore and .cursorignore, but so far that just hasn’t been my experience. For example when I go to edit a .env file I still get suggestions from Cursor Tab, plus I have absolutely no visibility whether the file has been indexed or not.
What I (and I bet others) would appreciate a lot is some way to strictly define that certain files and directories should be completely ignored - they shouldn’t be indexed and they should never be sent to an LLM.
5 Likes
i need this as well - specifcially for generated mock directories
2 Likes
Backing this 100%. Complete ignore, never leave the machine is essential. Looking forward to Cursor release bringing that.
1 Like
This is pretty critical, we need a .cursorignore
like .gitignore. I don’t want my API Keys or confidential code and algos being leaked to and trained on by AI models.
Why not create it:
import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
// Register command for adding cursor-ignore wrapper
let ignoreDisposable = vscode.commands.registerCommand('cursor.wrapWithIgnore', () => {
const editor = vscode.window.activeTextEditor;
if (editor) {
const selection = editor.selection;
const text = editor.document.getText(selection);
editor.edit(editBuilder => {
editBuilder.replace(selection,
`<!-- cursor-ignore -->\n${text}\n<!-- cursor-ignore-end -->`);
});
}
});
// Register command for adding cursor-focus wrapper
let focusDisposable = vscode.commands.registerCommand('cursor.wrapWithFocus', () => {
const editor = vscode.window.activeTextEditor;
if (editor) {
const selection = editor.selection;
const text = editor.document.getText(selection);
editor.edit(editBuilder => {
editBuilder.replace(selection,
`<!-- cursor-focus -->\n${text}\n<!-- cursor-focus-end -->`);
});
}
});
context.subscriptions.push(ignoreDisposable, focusDisposable);
}
2 Likes
Thank you. I really love your enthusiasm and the work you did to implement this. But I honestly cannot follow your code. It is way above my skills. I will need a secure and reliable update to the software done by the developers and baked into a new officially supported release.
Hey, as @krasinedev found, currently, .cursorignore
only does so much towards stopping your file being included in responses.
At the moment, adding a file to that file stops it from being indexed and won’t allow it to be read as automatic context by the composer.
However, Tab completions will still work in the file and if you have the file open in the editor, it will still be automatically suggested as context for your prompt.
We are looking at solutions in this area at the moment, so I would expect some changes in the near future!