如何使用VSCode扩展添加上下文菜单?

时间:2016-12-30 17:35:29

标签: visual-studio-code vscode-extensions

如何添加上下文菜单? (在资源管理器和/或编辑器中)

我尝试了以下不起作用:

constexpr

这是基于:

https://github.com/Microsoft/vscode/issues/3192

https://github.com/Microsoft/vscode/pull/7704

1 个答案:

答案 0 :(得分:6)

extensionAPI文档有一个工作示例:https://code.visualstudio.com/docs/extensionAPI/extension-points

  "contributes": {
    "commands": [
      {
          "command": "extension.sayHello",
          "title": "Say Hello"
      }
    ],
      "menus": {
        "explorer/context": [{
            "when": "resourceLangId == javascript",
            "command": "extension.sayHello",
            "group": "YourGroup@1"
      }]
    }
  },