Visual Studio Code and Prettier html formatting on separate lines

Viewed 484

I'm using VS Code, and Prettier and cannot get it to format the way I want it to be upon saving.

If I have a line like

<input type="checkbox" /> Label<br />

upon format/save, it becomes

<input type="checkbox" /> Label <br />

I don't want to turn off Format on Save since I want to be able to Format Document from time-to-time. Is there a setting to get the line breaks how I want them? I'd prefer it only wrap on line length and other wanted places (e.g. select and option tags on different lines)

Note: this is just a simplified example. There are many other cases where it's putting every tag on a separate line when I'd like them to stay on one.

1 Answers

You need to update your .prettierrc file in your root to have

 "printWidth": 1000

or whatever print width you are looking to have and it should fix this. Also check out the Prettier docs at https://prettier.io/docs/en/configuration.html to see other items you can configure.

Related