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


Authorยดs AnkiCodes image


Last edited on

2 Answers

Best answer

Thanks for your solution! I just ran into the problem, that I also have another AutoFormatter Extension installed for VS Code which didn't work because I specified prettier as defaultFormatter.

I could resolve it with overriding the defaultFormatter for the specific filetype where I want to use the other Extension for formatting:

  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[prisma]": {
    "editor.defaultFormatter": "Prisma.prisma"

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 ๐Ÿ˜‰