Visual Studio Code: Treat other extensions as HTML

(Tested on version 1.59.1)

It is also possible to set Associations through GUI:

Go to Settings->Text Editor->Files->Associations.

Set Item (file extension) and Value (language).

enter image description here


Update for VS Code 1.0:

There is a setting files.associations that can be used to assign file patterns to languages. For example:

"files.associations": {
  "*.tpl": "html",
  "*.master": "html"
}

Previous answer:

This is a commonly asked feature request and we are looking into this issue for the future.

As a workaround if you need to have a solutio now:

  • close VS Code
  • open C:\Users\<your name>\AppData\Local\Code\app-<latest-version>\resources\app\server\lib\mime.js
  • find the object literal knownTextMimes
  • for the file extension you want add the proper mime type
  • for example '.tpl': 'text/html'
  • save and restart code

Note: this change will not survive automatic updates but the hopes are that there is a better solution in the future update :)