Skip to content

Commit

Permalink
fix: Fixed hidden rules, resolve #588
Browse files Browse the repository at this point in the history
  • Loading branch information
weirongxu committed Jun 19, 2024
1 parent 014a048 commit a083afe
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/source/sources/file/fileSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,20 @@ export class FileSource extends ExplorerSource<FileNode> {
isHidden(filename: string) {
const hiddenRules = this.getHiddenRules();

if (
hiddenRules.patternMatches.some((pattern) =>
new RegExp(pattern).test(filename),
)
)
return true;

const { basename, extensions } = getExtensions(filename);
if (hiddenRules.filenames.includes(basename)) return true;

const extname = extensions[extensions.length - 1];
if (!extname) return false;

return (
hiddenRules.filenames.includes(basename) ||
hiddenRules.extensions.includes(extname) ||
hiddenRules.patternMatches.some((pattern) =>
new RegExp(pattern).test(filename),
)
);
return hiddenRules.extensions.includes(extname);
}

getNodesByPaths(fullpaths: string[]) {
Expand Down

0 comments on commit a083afe

Please sign in to comment.