How to keep 'format on save', but prevent VScode from breaking line when saving HTML file?

Viewed 29
1 Answers

This is the default behavior for Prettier. You can try to override the Prettier config print width (default 80) to a larger number, .i.e 200. This will prevent Prettier from breaking your lines, although it is not recommended. You might want to play around with this number until you find what works for you. Other setting you might want to apply is bracketSameLine: true this will put the closing bracket at the end of the last line instead of being alone on the next line. An example .prettierrc file with this config is:

{
  "printWidth": 200,
  "bracketSameLine": true
}
Related