How to add context menu with VSCode extension?

后端 未结 1 1771
一整个雨季
一整个雨季 2021-01-04 01:23

How do you add a context menu? (in the explorer and/or the editor)

I tried the following which doesn\'t work:

{
    \"command\": \"extension.sayHello         


        
相关标签:
1条回答
  • 2021-01-04 02:14

    The extensionAPI documentation has a working example: 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"
          }]
        }
      },
    
    0 讨论(0)
提交回复
热议问题