VSCode 扩展 API - 在资源管理器上下文菜单中识别文件或文件夹单击 [英] VSCode Extension API - Identify file or folder click in explorer context menu

查看:50
本文介绍了VSCode 扩展 API - 在资源管理器上下文菜单中识别文件或文件夹单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VSCode 1.3 添加了对向上下文菜单添加命令的支持.有没有办法确定是否单击了文件或文件夹以打开资源管理器上下文菜单?

VSCode 1.3 has added support for adding commands to context menus. Is there a way to identify whether a file or folder is clicked to open the explorer context menu?

"menus": {
    "explorer/context": [
        {
            "when": "????",
            "command": "extension.myCommand",
            "group": "myGroup"
        }
    ]
}

另外,这里的 when 子句中是否有一个全面的(ish)表达式列表?

Also, is there a comprehensive(ish) list of expressions that might be checked in the when clause here?

推荐答案

关于获取综合上下文键列表:在最近的 VSCode 版本中,有一个开发者:检查上下文键强>命令.执行命令后,它可以让您选择一个 UI 元素:

Regarding obtaining a comprehensive list of context keys: in recent VSCode versions, there's a Developer: Inspect Context Keys command. After executing the command, it lets you pick a UI element:

之后,开发控制台打开,您可以展开包含上下文键的完整列表及其在此范围"中的当前值的记录对象:

After that, the dev console opens, and you can expand the logged object that contains a full list of context keys and their current values in this "scope":

这篇关于VSCode 扩展 API - 在资源管理器上下文菜单中识别文件或文件夹单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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