如何在 VSCode 的 quickOpen 面板中预过滤 showCommands [英] How to pre-filter showCommands in VSCode's quickOpen panel

查看:29
本文介绍了如何在 VSCode 的 quickOpen 面板中预过滤 showCommands的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些扩展可以添加 4、6 或更多命令,但我不想为每个扩展设置快捷方式.理想情况下,我可以创建一个快捷方式来显示该扩展的所有命令.或者显示 workbench.action.showCommands 列表,其中已经设置了一些文本,以便只显示有趣的命令.像这样:

I got a few extensions that add 4, 6 or more commands and I don't want to set a shortcut for each of them. Ideally I could create a shortcut to show all commands of that extension. Alternatively something that shows the workbench.action.showCommands list with some text set already in there so that just the interesting commands are shown. Something like this:

{
    "key": "ctrl+[Backquote] z",
    "command": "workbench.action.showCommands",
    "args": { "text": "task marks" },
    "when": "editorTextFocus"
}

任何想法如何做到这一点?我在 VSCode 的 API 文档中找不到 workbench.action.showCommands.

Any ideas how to do this? I could not find workbench.action.showCommands in VSCode's API documentation.

推荐答案

尝试使用这个(使用您选择的任何键绑定):

Try using this (with whatever keybinding you choose) :

{
  "key": "alt+z",
  "command" : "workbench.action.quickOpen", 
   "args"   : ">task marks",
   "when"   : "editorTextFocus"
}

我从问题:向quickOpen面板添加参数中获得了语法.

奇怪的是,这行不通:

"command": "workbench.action.showCommands", 
"args": "task marks",

只有 workbench.action.quickOpen 命令会接受参数.

Only the workbench.action.quickOpen command will take the argument.

这篇关于如何在 VSCode 的 quickOpen 面板中预过滤 showCommands的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆