Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code: Prettier splits paragraph text to multiple lines

I have a long text in p tag and Prettier splits the text in this tag to multiple lines. I have 'word wrap' enabled.

How can I stop this from happening?

Before Save: long text enclosed in p tag before save

After Save: long text split into multiple lines after save

like image 634
Ekansh Saxena Avatar asked Aug 13 '26 12:08

Ekansh Saxena


2 Answers

Prettier is opinionated, it has only limited number of options. If you couldn’t find what you want in https://prettier.io/docs/en/options.html, so it’s not supported.

In general, better to accept Prettier behavior instead of fight against it. The reformatting, that prettier does, doesn’t harm.

You can try to increase width.

like image 88
Michael Freidgeim Avatar answered Aug 16 '26 04:08

Michael Freidgeim


1. Strech VS Code Window
Simply stretch/widen your VS code window and it'll get "fixed":

Strech/widen your VS Code Window

2. Change Print Width
As you can see from 1, it's not a real problem.
You can however also experiment with adjusting Prettier Print Width.

  1. Open VS code
  2. Click Manage > Settings
  3. Type in "Prettier" and scroll down to Prettier: Print Width to change it.

How to change Prettier Print Width

like image 44
Laz Avatar answered Aug 16 '26 04:08

Laz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!