I am building VS Code extension to support Git Flow. I have a dedicated View Container with TreeView with tree of branches, including features, releases, hotfixes, ...
What I want to do is a right click menu on a viewItem bit with a different list of elements. For instance when I right click on feature I want:
Checkout feature Rebase feature Pull feature Finish feature
Yet Checkout feature only if I right click on features that are not current branch.
I know about when in configuration.menus but I cannot access individual viewItem property there or can I?
Right now, the only way I see is to create a separate view in my view container for each prefix. One for feature, one for releases one for hotfixes. But that is not the way I would like it to be. In my opinion one tree with all branches is easier to use.
Does anyone know how to achieve custom context menus?
CodePudding user response:
The vscode.TreevItem has a property contextValue, assign this a string and use this in the when clause of the menu item
"when": "view == myGitFlow && viewItem == current"
"when": "view == myGitFlow && viewItem != current"

