Prettier-vscode: Prettier Extension Not working in VS Code

Created on 20 Dec 2019  路  20Comments  路  Source: prettier/prettier-vscode

Running the contributed command: 'prettier.openOutput' failed.
I am getting this error on VS code.

Most helpful comment

Reinstall VS Code is not good solution.

All 20 comments

Prettier latest version [3.17.0]
vs code latest version 1.41.1
Format on Save is 'ON'
Default Formatter esbenp.prettier-vscode

In my case this issue was caused by using the optional chaining operator (?). Try to run the prettier from the command line and see wether it returns any syntax errors.

I was facing the same problem.
But after reinstall, everything works again.

Having the same problem even after reinstalling. @williampsena did you mean resintalling the prettier extension, or reinstall VSCode?

Having the same problem even after reinstalling. @williampsena did you mean resintalling the prettier extension, or reinstall VSCode?

I reinstalled prettier extensions.

Having the same problem even after reinstalling. @williampsena did you mean reinstalling the prettier extension, or reinstall VSCode?

I tried uninstalling and reinstalling Prettier Extension but it didn't work for me so I uninstalled VS Code completely and then installed it again. Now Prettier is working fine. Earlier I was also using Auto Rename tag so maybe it was causing problem I don't know but after uninstalling VS code completely, the problem is gone.

Reinstalling prettier extensions did not work for me. Setup info:
Version: 1.41.1 Commit: 26076a4de974ead31f97692a0d32f90d735645c0 Date: 2019-12-18T14:57:51.166Z Electron: 6.1.5 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Darwin x64 18.7.0

Reinstalling prettier extensions did not work for me. Setup info:

Version: 1.41.1
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:57:51.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 18.7.0```

Yes, same here! reinstalling prettier didn't work for me. So I uninstalled VS Code completely and then reinstalled it and then I installed Prettier and it is working now. Try this.

Reinstall VS Code is not good solution.

I suggest this be opened again as I have the same problem

Looks like this is fixed with b57b238 - I've updated the extension and all seems to be fine now.

Looks like this is fixed with b57b238 - I've updated the extension and all seems to be fine now. <

Yes, it works now. Thank you for efficiency.
I have another problem, can someone tell me: My pretter formats only files from the root directory, from the subdirectory - no.
image
For some reason, it does not see the configuration file when formatting their subdirectories.

Hello Everyone!

I went down the list of issues and solutions and tried most of the suggestions and still not working for me. It works fine for JS but didn't work for HTML for me. When I launch it, the "INFO" shows that it is enabled for a wider range of languages the instantly cut the list shorter and excluded HTML.

I've uninstalled the extension, VS Code, restarted my computer and reinstalled them back and still the same issue. Any other suggestions gentlemen and gentleladies?

Below is the INFO message I got.

["INFO" - 8:23:22 PM] Enabling prettier for languages
[
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"json5",
"jsonc",
"less",
"markdown",
"mdx",
"mongo",
"postcss",
"scss",
"typescript",
"typescriptreact",
"vue",
"yaml"
]
["INFO" - 8:23:22 PM] Enabling prettier for range supported languages
[
"graphql",
"javascript",
"javascriptreact",
"json",
"typescript",
"typescriptreact"
]

Error formatting document.
["ERROR" - 10:45:54 AM] Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (13:53)

I don't know why this error is coming. If anyone has faced same problem then please let me know the solution.

It's not working for me either. I get the info messages saying "Enabling prettier for range supported languages", but I can't get it to prettify my code.

CMD + SHIFT + P only gives me the option for "Prettier: Create configuration file". I don't see any option to run it on the code.

I tried reinstalling VSC and the extension, but that didn't help. I'm using Prettier 3.20.0

OK I realised I had to press CMD + SHIFT + P, then type 'Format document' to get it to run. I should have read the manual more closely!

@paulmaunders that worked once... this is odd. I didn't have to manually do it on my desktop, but on my MBP it only reformats when I do it that way, or when I do the (recently learned) keystroke method of opt+shift+F. Weird....

FOUND IT!!!! under settings - search for "formatted" -- Default was set to NULL. I changed it to 'esbenp-prettier-vscode' and had to select manually Editor: Format on Save. Now it works as it should.

Pretty similar to you guys, I've selected the option "Format Document With..." found out the default was other than Prettier. Clicked "Configure Default Formatter..." and then Prettier.
Just in case any of you face similar issue in future.

Prettier latest version [3.17.0]
vs code latest version 1.41.1
Format on Save is 'ON'
Default Formatter esbenp.prettier-vscode

In case someone like me don't know this setting exists, this solves the problem. My default Editor:Default Formatter is set to null and Editor:Format on Save is not ticked. Thank you.

Was this page helpful?
0 / 5 - 0 ratings