我有一些扩展可以添加 4 个、6 个或更多命令,但我不想为每个扩展设置快捷方式。
理想情况下,我可以创建一个快捷方式来显示该扩展的所有命令。
或者,显示 workbench.action.showCommands
列表,其中已设置一些文本,以便仅显示有趣的命令。
像这样的事情:
{
"key": "ctrl+[Backquote] z",
"command": "workbench.action.showCommands",
"args": { "text": "task marks" },
"when": "editorTextFocus"
}
有什么想法可以做到这一点吗?我在 VSCode 的 API documentation 中找不到 workbench.action.showCommands
.
最佳答案
尝试使用它(使用您选择的任何键绑定(bind)):
{
"key": "alt+z",
"command" : "workbench.action.quickOpen",
"args" : ">task marks",
"when" : "editorTextFocus"
}
我从 issues: adding an argument to the quickOpen panel 获取了语法.
奇怪的是,这行不通:
"command": "workbench.action.showCommands",
"args": "task marks",
只有 workbench.action.quickOpen
命令才会接受参数。
关于visual-studio-code - 如何在 VSCode 的 QuickOpen 面板中预过滤 showCommands,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54420051/