none
[shortcut] How to switch between TypeScript and HTML with one (or two) shortcuts RRS feed

  • Question

  • Working with Angular2, I often have @Components written in typescript with html template inside.

    Atom supports syntax highlight of both at the same time, while VSCode doesn't.

    Right now you have to CTRL+K M and type typescript or html in order to switch, which is fine but kinda slow in the middle of development.

    I'd like to bind shortcuts change language on the fly using "workbench.action.editor.changeLanguageMode".
    Ideally would be something like

    { "key": "ctrl+win+h", "command": "workbench.action.editor.changeLanguageMode", value="html,typescript"  }

    but would be also ok something like

    { "key": "ctrl+win+h", "command": "workbench.action.editor.changeLanguageMode", value="html"  }
    { "key": "ctrl+win+t", "command": "workbench.action.editor.changeLanguageMode", value="typescript"  }

    Obviously the point is that keybindings.json doesn't support the "value" field.

    Is there any way to achieve this?

    Thursday, February 9, 2017 8:53 AM

All replies

  • You can use this extension Angular Html TS Switcher

    https://marketplace.visualstudio.com/items?itemName=OAS.593771d0-13b5-4de6-a192-165dd6f16144

    Which also allow you to customize the shortcuts 

    Friday, April 10, 2020 7:58 PM