@@ -291,6 +291,7 @@ export class ExplorerFindProvider implements IAsyncFindProvider<ExplorerItem> {
291
291
}
292
292
293
293
constructor (
294
+ private readonly filesFilter : FilesFilter ,
294
295
private readonly treeProvider : ( ) => WorkbenchCompressibleAsyncDataTree < ExplorerItem | ExplorerItem [ ] , ExplorerItem , FuzzyScore > ,
295
296
@ISearchService private readonly searchService : ISearchService ,
296
297
@IFileService private readonly fileService : IFileService ,
@@ -621,7 +622,10 @@ export class ExplorerFindProvider implements IAsyncFindProvider<ExplorerItem> {
621
622
const fileResultResources = fileResults . results . map ( result => result . resource ) ;
622
623
const directoryResources = getMatchingDirectoriesFromFiles ( folderResults . results . map ( result => result . resource ) , root , segmentMatchPattern ) ;
623
624
624
- return { explorerRoot : root , files : fileResultResources , directories : directoryResources , hitMaxResults : ! ! fileResults . limitHit || ! ! folderResults . limitHit } ;
625
+ const filteredFileResources = fileResultResources . filter ( resource => ! this . filesFilter . isIgnored ( resource , root . resource , false ) ) ;
626
+ const filteredDirectoryResources = directoryResources . filter ( resource => ! this . filesFilter . isIgnored ( resource , root . resource , true ) ) ;
627
+
628
+ return { explorerRoot : root , files : filteredFileResources , directories : filteredDirectoryResources , hitMaxResults : ! ! fileResults . limitHit || ! ! folderResults . limitHit } ;
625
629
}
626
630
}
627
631
@@ -1404,12 +1408,9 @@ export class FilesFilter implements ITreeFilter<ExplorerItem, FuzzyScore> {
1404
1408
// Hide those that match Hidden Patterns
1405
1409
const cached = this . hiddenExpressionPerRoot . get ( stat . root . resource . toString ( ) ) ;
1406
1410
const globMatch = cached ?. parsed ( path . relative ( stat . root . resource . path , stat . resource . path ) , stat . name , name => ! ! ( stat . parent && stat . parent . getChild ( name ) ) ) ;
1407
- // Small optimization to only traverse gitIgnore if the globMatch from fileExclude returned nothing
1408
- const ignoreFile = globMatch ? undefined : this . ignoreTreesPerRoot . get ( stat . root . resource . toString ( ) ) ?. findSubstr ( stat . resource ) ;
1409
- const isIncludedInTraversal = ignoreFile ?. isPathIncludedInTraversal ( stat . resource . path , stat . isDirectory ) ;
1410
- // Doing !undefined returns true and we want it to be false when undefined because that means it's not included in the ignore file
1411
- const isIgnoredByIgnoreFile = isIncludedInTraversal === undefined ? false : ! isIncludedInTraversal ;
1412
- if ( isIgnoredByIgnoreFile || globMatch || stat . parent ?. isExcluded ) {
1411
+ // Small optimization to only run isHiddenResource (traverse gitIgnore) if the globMatch from fileExclude returned nothing
1412
+ const isHiddenResource = ! ! globMatch ? true : this . isIgnored ( stat . resource , stat . root . resource , stat . isDirectory ) ;
1413
+ if ( isHiddenResource || stat . parent ?. isExcluded ) {
1413
1414
stat . isExcluded = true ;
1414
1415
const editors = this . editorService . visibleEditors ;
1415
1416
const editor = editors . find ( e => e . resource && this . uriIdentityService . extUri . isEqualOrParent ( e . resource , stat . resource ) ) ;
@@ -1424,6 +1425,14 @@ export class FilesFilter implements ITreeFilter<ExplorerItem, FuzzyScore> {
1424
1425
return true ;
1425
1426
}
1426
1427
1428
+ isIgnored ( resource : URI , rootResource : URI , isDirectory : boolean ) : boolean {
1429
+ const ignoreFile = this . ignoreTreesPerRoot . get ( rootResource . toString ( ) ) ?. findSubstr ( resource ) ;
1430
+ const isIncludedInTraversal = ignoreFile ?. isPathIncludedInTraversal ( resource . path , isDirectory ) ;
1431
+
1432
+ // Doing !undefined returns true and we want it to be false when undefined because that means it's not included in the ignore file
1433
+ return isIncludedInTraversal === undefined ? false : ! isIncludedInTraversal ;
1434
+ }
1435
+
1427
1436
dispose ( ) : void {
1428
1437
dispose ( this . toDispose ) ;
1429
1438
}
0 commit comments