Extension 'Prettier - Code Formatter' Cannot Format - (Mac v8.0)

Viewed 5230

Having a problem with Prettier not being able to format. I have format on save selected, the default format is set to use Prettier. Was working fine yesterday and now it is not formatting on save or when I run the format document command. No settings were changed, I did try uninstalling and reinstalling prettier. Force format document also returns an error.

Error

Setting Page 1

Setting Page 2

Version Installed

Force Format Error

3 Answers

In my case, it was because the prettier setting Prettier:enable was not turned on after the extension installed (finally found this after some time wondering why...).

To check go to File->preferences->settings and then type prettier and scroll down until you see Prettier:enable and make sure it is checked.

(In case you wonder, I figured this out when I look at the output of the prettier console)

Prettier Setting

You are probably using v8.0 of the Prettier extension for VS Code. Updating the extension to v8.1, where the issue is fixed, will solve your problem:

  • Find the "Prettier - Code Formatter" extension in your list of extensions in VS Code.
  • Press the "Update" button next to the extension.

Some people have had issues just updating, so alternatively you can uninstall then reinstall the Prettier extension.

Related