Prettier-vscode: Setting for wrapping params to multiple lines

Created on 1 Sep 2018  路  5Comments  路  Source: prettier/prettier-vscode

Hi,

Prettier seems to miss a setting for when it should wrap the parameters of a function.
I have attached 2 images, the first one is the desired output. And the second is the way it formats it when saving the file.

The format seems to be triggered by the length of the individual parameters.

How i want it

How it formats

locked

Most helpful comment

image

image

I switch the Prinit Width to 200, it seems not work銆侷 do hate this style... Oh my goddess!!!

All 5 comments

The line in question has 82 characters. Prettier's default printWidth is configured to 80, meaning it will wrap any line that goes over that (I think it's actually a bit more complicated than that; seems like it tries to wrap long param lists that come close to that value, even if they aren't over it).

Add a .prettierrc file to the root of your app with the following contents and see if that helps:

{
  "printWidth": 100
}

Also, you can check out the other available options you can set for prettier on this page.

@nickcabral explained it.

image

image

I switch the Prinit Width to 200, it seems not work銆侷 do hate this style... Oh my goddess!!!

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings