vscode-ruff icon indicating copy to clipboard operation
vscode-ruff copied to clipboard

Option to automatically exclude .ruff_cache from file explorer and search

Open jackpeplinski opened this issue 6 months ago • 5 comments

It would improve developer experience if the Ruff VS Code extension offered an option to automatically add .ruff_cache/ to files.exclude and search.exclude global settings.

Since .ruff_cache/ is auto-generated and not meant to be edited or searched, this behavior would align with how VS Code handles other similar folders, e.g., node_modules/.

Ideally, the extension would detect the folder and prompt the user to exclude it from the file explorer and search results. This would also demphasize the folder by greying-it-out. Happy to implement if others think this would useful!

jackpeplinski avatar Jun 25 '25 20:06 jackpeplinski

That does sound useful. Although I'm a bit surprised that this is necessary, given that .ruff_cache has a .gitignore.

MichaReiser avatar Jun 25 '25 20:06 MichaReiser

Regarding the two settings that you've mentioned, I agree that it'd be useful to exclude it from files.exclude as there's no point in seeing that folder in the explorer. But, that should be automatically done when .ruff_cache is included in your project's .gitignore file as per explorer.excludeGitignore setting.

And, for search.exclude, can you provide me which search bar gives you the .ruff_cache directory as I couldn't find any that gives me that as the search result.

dhruvmanila avatar Jun 26 '25 04:06 dhruvmanila

Actually, scratch that, I think this would be useful. This would need to be implemented via the contributes.configurationDefaults (https://code.visualstudio.com/api/references/contribution-points#contributes.configurationDefaults) which needs to be added in package.json.

dhruvmanila avatar Jun 26 '25 04:06 dhruvmanila

Hello @dhruvmanila, @MichaReiser I have created a PR implementing this, would appreciate your review whenever you get a chance.

Thank you : )

11happy avatar Oct 04 '25 12:10 11happy

I closed the PR adding this feature. You can find the reasoning in this comment

https://github.com/astral-sh/ruff-vscode/pull/853#issuecomment-3396258386

I'd be open to reconsidering excluding .ruff_cache from search by default using configurationDefaults. I don't think we should hide the folder by default.

Instead, we should update our documentation and point them towards files.exclude and search.exclude.

MichaReiser avatar Oct 13 '25 07:10 MichaReiser