Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode: Automatically open .html files in one window and .ts in the other

I'm writing Angular2 in VSCode. I split the editor window in two and keep all .html files on the right and all .ts files on the left.

It would be great to automate this, so that when I double click in the file browser the file is opened in the 'type appropriate' window split.

How can I configure or extend VSCode to do this?

enter image description here

like image 537
CodeCabbie Avatar asked Apr 06 '17 11:04

CodeCabbie


People also ask

How do I keep multiple files open in Visual Studio code?

Launch VS Code and press the “Ctrl” and “P” keys at the same time to search for a file to open in the current project. Type in the file name. To open the new file in a temporary tab, click on it once. To open the new file in a separate window that you can choose to close manually, double-click it.


2 Answers

I couldn't live without the extension angular2-switcher which adds the following navigations

  • Alt + U - Go to .ts
  • Alt + I - Go to .css
  • Alt + O - Go to .html
  • Alt + P - Go to .spec.ts

* Hold Shift on mac

Hopefully someday it'll support split screen too

like image 119
Simon_Weaver Avatar answered Oct 11 '22 13:10

Simon_Weaver


You can't do that today, unless you create a new extension.

But, with file-ext-switcher extension you can open the related file using a keybinding, which is great. It worth take a look.

like image 24
alefragnani Avatar answered Oct 11 '22 14:10

alefragnani