Working with prettier in Visual studio code – User friendly Tech help

n

“Whenever you are confronted with an opponent, conquer them with love.”

n

n

What is prettier ?

n

In layman terms its an handy tool that will format our code against some set standards, default formatting rules to achieve consistent code style.

n

How to install prettier  in VS Code?

n

n

Search > Prettier – Code formatter

n

n

n

Note:- Incase you have different IDE try installing prettier.

n

How to do perform user specific settings for prettier?

n

VS Code > File > Preferences > Settings > Under ‘user setttings’

n

n

    // Set the default prettier settingsn    "editor.formatOnSave": false,n    "prettier.singleQuote": true,n    "prettier.trailingComma": "all",n    // Enable per-languagen    "[javascript]": {n        "editor.formatOnSave": truen    }

n

Activate Prettier

n

1. CMD + Shift + P -> Format Document OR 1. Select the text you want to Prettify

n

2. CMD + Shift + P -> Format Selection

Was this article helpful?
YesNo

Similar Posts