Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCODE - Code formatting in *.hbs files

I have been using VS Code for a while now and I am loving it. But there is a small problem with code formatting. It does not work in handlebars (*.hbs) files. This option is simply unavailable while editing hbs file.

I have tried 'Beautify' extension, but it does not work properly for handlebars - it completely destroys the code.

Any help (or explanation of what am I doing wrong) on that topic would be much appreciated.

EDIT: Same issue applies to *.scss files. Can not format those either.

like image 906
Greg Avatar asked Dec 23 '15 10:12

Greg


People also ask

How do I format an HBS file?

You can click in the bottom right corner on 'Handlebars' and change the language mode to HTML. Then the 'format code' option will be shown.

Why does VS Code format on save?

You have configured prettier to format as per the default settings. If you don't see the code formatted automatically on file save then it might be because you have multiple formatters installed in VS Code.


1 Answers

You can click in the bottom right corner on 'Handlebars' and change the language mode to HTML. Then the 'format code' option will be shown.

like image 58
Gie Spaepen Avatar answered Sep 20 '22 01:09

Gie Spaepen