Esben Peterson, he's the original developer of Prettier for VS Code, as can be seen in the commit history.
Answer from Nick is tired on Stack OverflowVideos
- Select
File -> Preferences -> Settings(Ctrl+comma) and search formformatter - Set Prettiers as Default formatter.

If above does not work:
ctrl+shift+p > Format Document With... > Configure Default Formatter... > Prettier - Code formatter
This also work with ctrl+shift+I
If doing what @Simin Maleki mentioned does not solve it for you, there is a chance that your default formatter is not set:
File > Preferences > Settings > Search for "default formatter"
Make sure your Editor: Default Formatter field is not null but rather Prettier - Code formatter (esbenp.prettier-vscode) and that all the languages below are ticked. This fixed my issue.
STEP BY STEP WALKTHROUGH

Also make sure that your format on save is enabled:

Don't know why but setting Default Formatter to ebsenp.prettier didn't work for me. But I found a similar command that worked.
- ctrl + shift + p
- Format document with
- Configure default formatter
- Choose prettier
Open settings by clicking the cog in the bottom left of the vs code side bar and selecting settings from the menu, or by hitting Ctrl+,
At the top right of the settings pane, hit the open file icon (if you hover, the tooltip will read 'Open Settings (JSON)'
Add the following line to the settings json:
"editor.defaultFormatter": "esbenp.prettier-vscode"
Follow these steps:
- CTRL + SHIFT + P
- Format Document (in pop-up bar)
- Select
Format Document - Select
Configure Default Formatter... - Select
Prettier - Code formatter
Done!
In VSCode settings, search for "Editor: Default Formatter", set it to esbenp.prettier-vscode and restart VSCode.
I have been searching google for several hours.
Many user have similar problem with me. https://stackoverflow.com/questions/52586965/why-does-prettier-does-not-format-code-in-vs-code/64273353#64273353
But none of the solution works for me.
https://imgur.com/2ssn1Vt
I have prettier installed. And I have tried the following
1.Command + Shift + p
2.type format document with
3.select Configure Default Formatter...
https://imgur.com/xw5oYvS
Then I cant select Prettier as default.
I only give me Python(default) as the only option.
I have a setting.json inside my root. Is it related?
https://imgur.com/KbEdsOV
For those trying to quickly change Prettier settings for VS Code. Here are the steps:
- Go to FILE -> PREFERENCES -> SETTINGS. (VS Code Menus)
- Settings window should open. Above (Top) there is a search. Type "Prettier"
- You should see the available Prettier settings. You can modify them :)
The new way to configure prettier settings:
- at the root of your project folder, create a new config file (I'd suggest calling it either
.prettierrc.jsonor just.prettierrc) - in that new file, add json custom settings: my go-to settings for JS are as follows:
{
"trailingComma": "none",
"tabWidth": 4,
"semi": true,
"singleQuote": true
}
I'd suggest doing this in each of your projects and including in any source control, that way every pull of the repo will automatically set some base settings for that developer's instance of prettier.