- 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
- 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:

Videos
I got back to VScode after few months, and now Prettier is not working for me. I have tried saving the setting manually as well, but it is not working.
Prettier ver - 5.8.0
VScode ver - 1.52.1
Please help.!
Thankyou.
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.
In Cursor, “format on save” (auto prettier) isn’t working for me.
It was working fine until yesterday, but after updating the Cursor editor, it seems to have stopped.
What’s weird is that in VS Code, it works perfectly on the same project/settings.
Is anyone else experiencing this, or is it just me?
Update, i just find the solution if anyone is having the same problem i have to add the following lines to user setting json
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
Press Ctrl+shift+p and type Preferences: Open User Settings (JSON). In that json file add the following line and save. This should enable so vscode formats the code each time you save.
{
"editor.formatOnSave": true
}