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

我尝试了以下无效的方法:

{
    "command": "extension.sayHello",
    "title": "Say Hello",
    "context": {
        "where": "explorer/context",
        "when": "json"
    }
}


这是基于:

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

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

最佳答案

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"
      }]
    }
  },

关于visual-studio-code - 如何添加带有VSCode扩展名的上下文菜单?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41400280/

10-11 23:44