-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pattern matching to when
clause, when contributing menus
#26044
Comments
Hi, Any update on this? |
@chrisdias I will push an additional change that expands this to support normal regular expressions instead of just glob-patterns. We figured that's more powerful and closer to ST |
when
clause, when contributing menus when
clause, when contributing menus
Will this be usable in matching any when clause value? Can you give an example? |
You write "explorer/context": [
{
"command": "extension.sayHello",
"when": "resourceFilename =~ /z$/"
}] |
This is AWESOME! Should reduce the number of duplicate menu items I need to define |
Slight update on this: The value must be enclosed in slashes, so |
@jrieken FYI: But without much success. After looking into the test item and the corresponding feature item, I noticed that the latest syntax uses regular regexp syntax. I've taken the liberty to change the release notes to this: I did not attempt to clarify why |
Hmm, I am writing a simple It works without any when clause, but the menu item also shows up, when r-clicking inside the empty space. I would like to prevent it. Is there something like this |
Ok I found |
In vscode-java, we'd like to be able to provide context menus for all gradle files. The current
when
clause is limited to language types ("when": "resourceLangId == groovy"
) or a single file name ("when": "resourceFilename == 'build.gradle'"
).It would be helpful if there was support for glob pattern matching, as @jrieken mentioned in #3192 (comment)
The text was updated successfully, but these errors were encountered: