Skip to content

Provide more specific 'when' clause for default keybindings #662

@alex-che

Description

@alex-che

cpptools has the Alt+O keybinding for 'Switch Header/Source' command.
angular2-switcher has the Alt+O keybinding for 'Open Corresponding template(html) File'.
Having both these extensions makes only one keybinding to work.
Currently, cpptools has "editorTextFocus" for the "when" keybinding property, while angular2-switcher does not have the property set at all.
The following overrides in the user keybindings.json seems to fix this for me:

  {
       "key": "alt+o",
       "command": "extension.switchTemplate",
       "when": "editorTextFocus && editorLangId=='typescript'"
   },
   {
       "key": "alt+o",
       "command": "C_Cpp.SwitchHeaderSource",
       "when": "editorTextFocus && editorLangId=='cpp'"
   } 

Is it possible/reasonable to have this (or maybe some better) value for the "when" keybinding property out-of-the-box, to reduce the probability of keybindings conflicts with other extensions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions