The auto format in VS Code is making my code unreadable by removing indentations. I don't know how to turn this off for handlebars only.
Input:
{{ range ... }}
{{ if .... }}
{{if ... }}
<tag></tag>
{{end}}
{{end}}
{{end}}
Output
{{ range ... }}
{{ if .... }}
{{if ... }}
<tag></tag>
{{end}}
{{end}}
{{end}}
Any way to prevent this?
VSCode – Code Formatting Shortcuts The code formatting is available in Visual Studio Code (VSCode) through the following shortcuts or key combinations: On Windows Shift + Alt + F. On macOS Shift + Option + F. On Linux Ctrl + Shift + I.
VS Code Auto Format On SaveOpen Visual Studio Code editor. Click the “Settings” gear icon in the bottom-left corner. Search “Formatter” and click the “Editor: Default Formatter” option. From the drop-down menu, select whichever code formatter you want to use.
You can set the document type by using select Language Mode (change Language Mode ctrl + k + m
), set the language to HTML template HTML Twig.
Then do formating, it will format perfect. It worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With