Reputation: 191
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
Upvotes: 16
Views: 17633
Reputation: 2391
Edit: The extension is now deprecated unfortunately. ⤵︎
There's a fork of Prettier called Prettier Now that allows this.
After downloading, go into your settings.json
and add ⤵︎
"prettier.arrayExpand": true
Upvotes: 2
Reputation: 904
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
],
Upvotes: 15