Activate command on TreeViewItem click, VSCode Extension

不羁岁月 提交于 2020-03-21 19:26:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!