Search code examples
visual-studio-codeprettier

Prettier in VS code wraping


I'm using prettier in VS code. When I'm Writing something like this:

document.getElementById(`current--${activePlayer}`).textContent = currentScore;

It's get formatted into

  document.getElementById(
    `current--${activePlayer}`
  ).textContent = currentScore;

Is there a way to keep it the first way? Thanks


Solution

  • Print Width

    You can create a prettier config file in your project and increase the value of print width. The code tends to break in newline when it's length exceeds the default value in your editor.

    You can configure the prettier rules in .prettierrc file.

    {
      "printWidth": 100,
    }