VSCode Extension API - Identify file or folder click in explorer context menu

前端 未结 5 1849
野趣味
野趣味 2020-12-06 18:42

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?

5条回答
  •  广开言路
    2020-12-06 19:00

    A write up about the feature is here. But basically:

    • the when is the same as the keybindings-when and can use the same keys
    • the when can use two new keys resourceScheme and resourceLangId which are available without an editor - think of the explorer context menu
    • the when can be a boolean configuration value, e.g config.editor.lineNumbers

    My menu:

    "menus":{
        "explorer/context": [
            {
                "when": "resourceLangId == sql",
                "command": "extension.myCmd"
            }
        ]
    

提交回复
热议问题