Use glob expressions to filter files and folders #3335
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I added a feature to filter files and folders.
Sometimes we don't want certain files or folders displayed in the sidebar. It would look cleaner if we excluded them from the tree, such as the Image assets folders.
So I developed this feature. By configuring the glob patterns, users can exclude files or folders that they do not want to display. Use "," to separate multiple pattern.
Suppose my directory structure is as follows:

The following three expressions are configured:
**/*t/tempto exclude the file or folder namedtempin base folder**/*temp.mdto exclude all files or folders whose names end withtemp.md**/*.assetsto exclude all files or folders whose names end with.assetsUse "," to separate multiple pattern:
**/*t/temp,**/*temp.md,**/*.assetsFinally we will see the following structure in the sidebar:
The minimatch module is used to parse glob patterns.