You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current API documentation for workspace.findFiles() contains the following description for the exclude param:
A glob pattern that defines files and folders to exclude. The glob pattern will be matched against the file paths of resulting matches relative to their workspace. When undefined, default file-excludes (e.g. the files.exclude-setting but not search.exclude) will apply. When null, no excludes will apply.
However, the files.exclude setting does not only seem to be applied by default (or when using undefined as documented), but also when specifying a string exclude pattern. Only when explicitly specifying null, the setting is not applied.
In my use case I want to find some files that are usually hidden from the developer (thus I don't want files.exclude to be applied), but I want to exclude some large directories like node_modules and .git from the search for better performance:
To me, it's implied that files.exclude is applied by default, then we describe the difference between null/undefined. To me, it would be very confusing to not apply the default excludes when you specify a query, but then to add extra excludes when you pass undefined. In any case, this does lack flexibility for cases like yours, and we do need to revamp this API. I think that's covered by the other issues you found. Sorry that it doesn't currently fit your needs.
The current API documentation for
workspace.findFiles()
contains the following description for theexclude
param:(via https://code.visualstudio.com/api/references/vscode-api)
However, the
files.exclude
setting does not only seem to be applied by default (or when usingundefined
as documented), but also when specifying a string exclude pattern. Only when explicitly specifyingnull
, the setting is not applied.In my use case I want to find some files that are usually hidden from the developer (thus I don't want
files.exclude
to be applied), but I want to exclude some large directories likenode_modules
and.git
from the search for better performance:This won't find my files - it only works after replacing my exclude pattern with
null
.Is this a bug? Or is the documentation just not clear for this case?
Relevant code:
vscode/src/vs/workbench/api/common/extHostWorkspace.ts
Line 442 in 1805df1
vscode/src/vs/workbench/api/browser/mainThreadWorkspace.ts
Line 149 in 1805df1
vscode/src/vs/workbench/services/search/common/queryBuilder.ts
Line 334 in 1805df1
Related issues:
Thanks for looking into it!
The text was updated successfully, but these errors were encountered: