我想用一些参数重用命令。 我发现键绑定可以使用“args”属性执行此操作:
{
"key": "cmd+k 8",
"command": "editor.action.insertSnippet",
"when": "resourceLangId == 'markdown'",
"args": {
"name": "Insert bold text"
}
}
所以我尝试以类似的方式编写我的package.json / contributions / menus并且它不起作用:
"commands": [
{
"command": "extension.sayHello",
"title": "Say Hello"
}
],
"menus": {
"editor/context": [
{
//menu one
"command": "extension.sayHello",
"group": "navigation@1",
"args": {
"text": "Say Hello 1!"
}
},
{
//menu two
"command": "extension.sayHello",
"group": "navigation@2",
"args": {
"text": "Say Hello 2!"
}
}
]
}
我想将“text”传递给命令处理函数。 是否有任何功能可归档类似的结果?