-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Is an extension able to contribute menu items dynamically? #15235
Comments
That is correct and I would like to know why it's not powerful enough? |
Hi @jrieken ,
That is, the menus my extension contributes first apply to a project with a special folder structure. Then according to different resource types, show different menus. Hope this could clarify. |
The logic is like: A command is a function with name/id, like
That's the theory. In practice it is often hard to formulate the when clause, because For resources we have the following context keys: |
Thank you very much for the detailed introduction.
However I will look at the source code about the mechanism to define |
The problem you will have is that the explorer isn't represented in the API, e.g. there no explorer selection events etc that would enable you to update those context keys. I might be able out by adding more context keys in the spirit of |
It's indeed very special even need to scan the content of the file, haha. Thank you anyway. However, could you make this a feature request? To be simple, you can allow the BTW, I created a Sublime plugin for my purpose by using |
The problem is that it must work other way around. A context must update by itself without being asked. Otherwise we would have to wait for those updates/evaluations before handling a keyboard event or before opening a menu. That's what makes it so hard |
I want to create an extension which shows custom
explorer/context
menus for some special project folder structure. Is that possible?For Sublime plugin I could define
is_visible
method on a command to decide if the menu item is shown. But I didn't see equivalent mechanism in vscode. The similar one iswhen
clause but it's not powerful enough to do it.The text was updated successfully, but these errors were encountered: