getcursor / cursor

The AI-powered code editor
https://cursor.sh
20.59k stars 1.38k forks source link

[Feature Request] Allow specification of files/folders to always include in context #1523

Open gavry opened 6 days ago

gavry commented 6 days ago

Is your feature request related to a problem? Please describe. I could see this extending to many other use cases, but it can be annoying when cursor doesn't use the packages installed in the repo. In chat, I can @ the file/folder, but it would be nice to default to it, and possibly have the same context inclusion on autocomplete.

Describe the solution you'd like A way to set default files to be included in context, probably with glob syntax support? For me, including the package.json files would be amazing. I could paste these into my .cursorrules file, but then I'd need to keep them in sync. Other config files would be great too - e.g. if I have a /config folder, including that would inject my tailwind config, vite config, tsconfig etc.

One possible solution could be to allow absolute referencing of files/folders in .cursorrules files? This would require parsing/preprocessing of the rules files, rather than the current version, where I assume the text is just inserted raw into the prompt.

Additional context It would need to know the location of the files as well; alternatively, nested specifications like this could be indicated to overrule parent specs? The reasoning being that in a monorepo, the installed packages would differ based on which folder you're in. If doable, it might be best to allow overruling to minimize token usage and avoid conflicting context (different pkg versions, etc.). Maybe there could just be a flag at the top of .cursorrules files to determine their behavior, relative to parent/children .cursorrules files?

Thanks for a great product! Enjoying it a lot!