Ask Question

VSCode - Prettier does not format on save

Since recently the "editor.formatOnSave": true, is not working in my VSCode. Previously prettier formatted the code automatically on save and it worked… Any idea why it stopped working?

VS Code

32 views

Author´s Anki Batsukh image

Anki Batsukh

Last edited on

1 Answer available

Best answer

Obviously now you have to tell VSCode which plugin you want to use as default formatter.
Set this on in your settings.json

{
  ...
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode"
}

Of course if you have installed the esbenp.prettier-vscode plugin 😉

Last edited on