'How to change the formatting of VS Code with Prettier enabled?
When I use CTRL+S, my code is automatically formatted to this:
< h1 > Title < /h1 >
where it all saves to the same line. But I want it to format like this:
< h1 >
Title
< /h1 >
Where all three properties are saved to their own respective line. I prefer this because it makes it personally makes it better for me to read and edit my code.
How do I change this?
Solution 1:[1]
You cannot change the way how this extension format your code! But you can keep this extension enabled and make HTML as an exception like this way:
create a .prettierignore
file
{
"editor.defaultFormatter":"esbenq.prettier-vscode",
"[HTML]":{
"editor.defaultFormatter":"<another formatter>"
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Peter Csala |