microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.83k stars 29.49k forks source link

Nested alternate groups in glob patterns #230275

Open bmeck opened 1 month ago

bmeck commented 1 month ago

Problem:

VSCode does not support a common feature of globs in other environments. Other glob matchers support nested alternation like "{*requirements{.frozen,{[-_]*,}.txt},requirements/*.txt}" ( taken from https://docs.socket.dev/reference/getreportsupportedfiles ).

VSCode does not allow for these in various places like "workspaceContains" or createFileSystemWatcher. When using these you get errors like:

error parsing glob '**/{*[rR][eE][qQ][uU][iI][rR][eE][mM][eE][nN][tT][sS]{.[fF][rR][oO][zZ][eE][nN],{[-_]*,}.[tT][xX][tT]},[rR][eE][qQ][uU][iI][rR][eE][mM][eE][nN][tT][sS]/*.[tT][xX][tT]}': nested alternate groups are not allowed

Workaround:

It is possible to flatten globs via expansion of nested alternates such that things like a{x,{y,z}}b becomes a{x,y,z}b (above expands to {*requirements.frozen,*requirements[-_]*.txt,*requirements.txt,requirements/*.txt}.); however doing so can vastly expand the glob pattern and doesn't match common usage.

vs-code-engineering[bot] commented 1 month ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

vs-code-engineering[bot] commented 6 days ago

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!