When I use a long array and console, prettier formats it into multiple lines which is annoying in some cases. I want them break after a certain length. Can I set a breaking point for the prettier where it will make the new line? Please check the image. Prettier format demo
Set the option in settings. Appending this line to the end of your settings. json file means Prettier will only wrap the line when it exceeds 1000 characters (essentially never). You can change this number to preference, for reference the default is 80 . Just make sure to save changes to the file and you are done!
A quick fix is to go to Prettier Extension Settings (ctrl + shift + X) and in Prettier Extension Settings search for "Print Width" set it to 250 or anything that works for you. 2: Change the value of Print Width to your liking. To disable format code on save.
Sadly can't be done, here you can find the discussion about the issue. The only apparently solution it's to add a comment //
after the first array element:
Example:
imports: [
BrowserModule, //
FoodModule,
SharedModule,
AppRoutingModule
],
There's a fork of Prettier called Prettier Now that allows this.
After downloading, go into your settings.json
and add ⤵︎
"prettier.arrayExpand": true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With