How to disable prettier settings creating new line of > of html tag?

rosiejaneenomar picture rosiejaneenomar · Dec 26, 2018 · Viewed 17.7k times · Source

I walk through the Prettier extension of Vscode and I can't find how to disable this scenario. See the > of html tag.

Here's a sample code that needed some fix, every time i run the Prettier. The output is this:

<tag-html
 [val1]="valueStr"
 [val2]="valueStr"
>
</tag-html>

I want Prettier to output:

<tag-html
 [val1]="valueStr"
 [val2]="valueStr">
</tag-html>

Answer

Pandiyan Cool picture Pandiyan Cool · Dec 26, 2018

This can be done with help of VS Code itself. Place the following entry in your workspace settings in your vs code.

"html.format.wrapAttributes": "force-aligned"

You don't need any external plugins or extension to do this.

Or you can use the GUI settings page as well

enter image description here

enter image description here

UPDATE 01

Based on github issue in prettier repo https://github.com/prettier/prettier-vscode/issues/646

you can still merge the settings I have mentioned above.