Why does Prettier not format code in VS Code?
How I've sorted it after having super huge frustrations with Prettier stopping working in VSCode.
Command Palette, and type:
Format Document With
Configure Default Formatter...and then choose
Prettier - Code formatter.
This sorted the problem for me magically.
Depending on your case this might help you...
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
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: