问题
I would like to run a command on the click of a tree view item, rather than in a menu that comes up. Right now in my package.json, I have this:
{
"command": "test.view.showError",
"when": "view == test.view && viewItem == test",
"group": "inline"
}
Right now, "inline" will put an icon next to the words which you have to click to run the command, but I would like the command to run when I click on the node itself.
What do I change "group" to? Or do I do something different entirely?
Thanks
回答1:
You have to set the command
property on the TreeItem
instance.
command?: Command
The command that should be executed when the tree item is selected.
https://code.visualstudio.com/docs/extensionAPI/vscode-api#TreeItem
来源:https://stackoverflow.com/questions/51525821/activate-command-on-treeviewitem-click-vscode-extension