单击 TreeViewItem 上的激活命令,VSCode 扩展 [英] Activate command on TreeViewItem click, VSCode Extension
问题描述
我想在单击树视图项时运行命令,而不是在出现的菜单中运行.现在在我的 package.json 中,我有这个:
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?
谢谢
推荐答案
您必须在 TreeItem
实例上设置 command
属性.
You have to set the command
property on the TreeItem
instance.
命令?:命令
选择树项时应执行的命令.
https://code.visualstudio.com/docs/extensionAPI/vscode-api#TreeItem
这篇关于单击 TreeViewItem 上的激活命令,VSCode 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!