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

前端 未结 5 1843
野趣味
野趣味 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:03

    You can use "when": "explorerResourceIsFolder".

    I had to dig through the code to find it (I was actually writing up a response to say it didn't exist and enumerating the possible clause values when I saw it).

    As of v1.10.1:

    config.
    editorIsOpen
    explorerResourceIsFolder
    explorerViewletFocus
    explorerViewletVisible
    filesExplorerFocus
    globalMessageVisible
    inDebugMode
    inQuickOpen
    inZenMode
    listFocus
    openEditorsFocus
    resource (Uri information: path, query, scheme, etc)
    resourceFilename
    resourceLangId
    resourceScheme
    scmProvider
    textCompareEditorVisible
    

    I've submitted an issue to improve the documentation for this.

提交回复
热议问题