Home > Enterprise >  Formatting tmpl files using VSC
Formatting tmpl files using VSC

Time:03-12

How can I auto format on save for tmpl files using VSC? Context is tmpl in a Go program. I already have auto format on save enabled, and have tried lots of different extensions including Prettier, but have not been able to get tmpl extension files to auto format on save. I have also gone into formatting extensions and added **/*.tmpl but nothing works. I am also aware of this post but as far as I am aware that is for go files not tmpl files (tried it and didn't work anyway).

CodePudding user response:

Okay so it turns out that extensions can only format certain languages, so my tmpl needs to be in a valid language for it to be formatted. Mine was in plain text so that's why no formatting worked. Since my tmpl files contained valid HTML I changed it to HTML and was able to auto format using any HTML formatter.

  • Related