Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindFiles2OptionsNew.useIgnoreFiles is quite complicated #226828

Open
alexdima opened this issue Aug 27, 2024 · 1 comment
Open

FindFiles2OptionsNew.useIgnoreFiles is quite complicated #226828

alexdima opened this issue Aug 27, 2024 · 1 comment
Assignees

Comments

@alexdima
Copy link
Member

alexdima commented Aug 27, 2024

Testing #226670

I'm not quite sure how to express this, but the useIgnoreFiles option is quite complex and I'm not sure if it's necessary to be so complex. If I understand its purpose correctly, the findFiles2New API will by default do some filtering on top of the disk. In other words, it will respect whatever settings are defined in the workspace or defined by the user w.r.t. ignoring files.

Then, useIgnoreFiles is a mechanism to ask the vscode API to ignore the settings and be 100% transparent and just return whatever the disk has.

My question is: how could an extension author know if they should set useIgnoreFiles.parent to false? How about useIgnoreFiles.global? These two settings seem to be extremely personal to the user that has decided to check out the repository in a folder where they define an ignore file. Or maybe they have a global ignore file. But how could an extension author know what kind of setup they're dealing with?

So I'd suggest simplifying the API, allow extension authors to either opt for the "on disk" no-filters file search or for the "user configured" filter. Also, I think a better name for such a simplified setting might be respectUserDefinedFilters, respectConfigurationFilters or disableFilters, disableConfigurationFilters...

Edit: Looking at useExcludeSettings, the same situation appears. How should I, as an extension author, know which value to use ExcludeSettingOptions.FilesExclude vs ExcludeSettingOptions.SearchAndFilesExclude and why isn't there a ExcludeSettingOptions.SearchExclude.

I feel that the API is quite complex and I'm not sure if such complexity is required. Maybe you have use-cases in mind for all these settings?

@andreamah
Copy link
Contributor

andreamah commented Aug 30, 2024

I actually had this discussion with others before #205692.

My question is: how could an extension author know if they should set useIgnoreFiles.parent to false? How about useIgnoreFiles.global? These two settings seem to be extremely personal to the user that has decided to check out the repository in a folder where they define an ignore file. Or maybe they have a global ignore file. But how could an extension author know what kind of setup they're dealing with?

I guess that these are options that ripgrep provides and are configured in settings, so we should give the extension authors the right to overwrite it. If I think about it more, it's less about "I need global ignore files" (for example) and more like "I want to make the searches consistent for everyone, regardless of which ignore settings that they have, so I'll give them a default value that makes sense to me"

Looking at useExcludeSettings, the same situation appears. How should I, as an extension author, know which value to use ExcludeSettingOptions.FilesExclude vs ExcludeSettingOptions.SearchAndFilesExclude and why isn't there a ExcludeSettingOptions.SearchExclude.

There isn't a ExcludeSettingOptions.SearchExclude because there's no way in the UI to do that. The search.excludes setting itself says that it inherits the files.excludes. I don't have a particular use case for this, but I'd imagine that using ExcludeSettingOptions.SearchAndFilesExclude is like saying "I'll only search where vscode usually looks when it does a workspace search (ie: ignore node modules)", whereas ExcludeSettingOptions.FilesExclude means "I only want to search in what is visible in the file explorer".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants