Ability to use regexp?
See title :)
Feature Request
It would be very interesting if one would be able to define multiple glob patterns like those used in the *.code-workspace and .vscode/settings.json settings:
Notice that VS Code implements its own glob pattern library for performing these file/folder matchings.
Example
Consider these glob patterns in the following example.code-workspace file:
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.exclude": {
"**/.git": true,
"**/.ssh": true,
"**/.tmp": true,
},
"files.watcherExclude": {
"**/.cproject/*": true,
"**/.classpath/*": true,
"**/.buildpath/*": true,
"**/.gradle/*": true,
"**/.metadata/*": true,
"**/target/*": true,
"**/bin/*": true,
},
"search.exclude": {
"**/__pycache__": true,
"**/.eggs": true,
"**/.cache": true,
"**/.mypy_cache": true,
"**/.pytest_cache": true,
"**/*.pyc": true,
"**/*.egg": true,
},
}
}
Settings
See a suggestion for glob patterns configuration in the following suggestion.code-workspace file:
{
"folders": [
{
"path": "."
}
],
"settings": {
"folder-path-color.folders": [
{
"tooltip": "Source Files",
"symbol": "S",
"color": "green",
// Keep compatibility
"path": "src"
},
{
"tooltip": "Documentation",
"symbol": "D",
"color": "yellow",
"path": "docs"
},
{
"symbol": "VS",
"tooltip": "VS Code Configuration",
// New multipattern style
"include": {
"**/.vscode": true,
"**/.devcontainer": true,
"*.code-workspace": true
}
},
{
"tooltip": "Compiled object files",
"color": "red",
"symbol": "B",
"include": {
"**/bin": true,
"**/build": true,
"**/target": true
}
}
]
}
}
+1 exactly what I whish!
you can also keep the variable as path. If it's a the current way of working. If it's a object, then it's a new way.
But even so, src is in the example is not even an blog pattern... so why not simply change the parsing to glob?
you can also keep the variable as
path. If it's a the current way of working. If it's a object, then it's a new way. But even so,srcis in the example is not even an blog pattern... so why not simply change the parsing to glob?
Reasons
There are some advantages of using a using pattern matching rather than exact matching
- You can write less configuration entries by matching many repeated directories/files with a pattern rather then explicitly writing the all the paths.
- You can reuse the same patterns for all other source code repositories that use the same development languages and folder/file patterns.
- You can configure the patterns globally by setting them in the User Settings JSON file.
There are a couple of things that are easier when using pattern matching rather than exact matching:
- You can assign/override distinct icons/colors for nested files/folders regardless of was it's parent/root folder is.
- You can easily address distinct files/folders mixed in more than one path all at once in the same configuration rule.
- Multi-module project repositories tend to have the same sub-directory names distributed inside more than one sub-folder could led to a single set of rules for matching them all at once.
Example
Consider the following directory tree from a hipotetical git cloned repository:
gitcloned
├── ci
│ ├── scripts
│ │ └── setup.sh
│ └── workflows
│ ├── build.yaml
│ └── deploy.yaml
├── docs
│ └── usage.md
├── src
│ ├── bin
│ │ ├── myapp
│ │ └── mylib.so
│ ├── build
│ │ ├── functions.o
│ │ ├── helpers.o
│ │ └── main.o
│ ├── lib
│ │ ├── lib-external.so
│ │ └── lib-interned.so
│ ├── resources
│ │ ├── image.png
│ │ ├── datapoints.csv
│ ├── temp
│ │ ├── build.tmp
│ │ └── generated.tmp
│ ├── build.log
│ ├── functions.c
│ ├── functions.h
│ ├── helpers.c
│ ├── helpers.h
│ ├── main.c
│ └── Makefile
├── temp
│ ├── package.zip
│ └── sketch.txt
├── configure.log
└── readme.md
Notice that if you have the abitily to match files/folders by pattern:
- You can make a single rule to mach all
tempdirectories regardless of its parent folders. - You can make a single rule to mach all
*.logfiles regardless of their location. - You can make a single rule to mach all
build,lib,resources, andbindirectories when the repository have more than one module each one contained in its own subfolder.
I agree, please add this feature, and keep me updated if it ever gets added. It would be amazing to be able to use glob patterns in this extension, it is already super helpful as is but this would make it even better!