andrew macnaughton
andrew macnaughton

Reputation: 53

How do i get prettier to be more pretty in vscode

This has been driving me wild for a little while here and i can't figure it out. I have tried setting my prettier.printWidth to 160 or 400 but it makes no difference. My environment is Vscode with prettier/vetur for Vue. I can use // prettier-ignore above the code but that's not a solution.

How i want it to look:

 // prettier-ignore
    if(!this.dataFields.some((field) => this.item.field && field.text === this.item.field)) {
      // Find the field in the all fields list
      const foundField = this.allDataFields.find((field) => field.text === this.item.field)

How it actually looks:

 if (
      !this.dataFields.some(
        (field) => this.item.field && field.text === this.item.field
      )
    ) {
      // Find the field in the all fields list
      const foundField = this.allDataFields.find(
        (field) => field.text === this.item.field
      )

Upvotes: 2

Views: 123

Answers (1)

carlfriedrich
carlfriedrich

Reputation: 4019

Prettier has very few configuration options by design. It offers a small amount of control concerning multi-line objects, but in the end it it designed to take the decision on how to style certain code elements off the developers.

So the only options I see here are:

  1. Accept Prettier's suggestions, lean back and be relieved that you never have to think or discuss about code styling again.

OR

  1. Don't use Prettier.

Upvotes: 2

Related Questions