2

everyone! My Prettier extension is not working in VS Code. I already set it as default, checked if all the languages are ticked and everything I could find here. It happened before too but usually it helped to click on "Format Document" in Command Palette and code appeared formatted immediately. But now it all seems like it is working: I can see in the Prettier`s output that formatting is completed, no problems found. But in fact it just does not formatting anything and code remains still. What else could it be? What can I do?

Also I noticed Prettier and Format Document works when I work in another folders, it seems to not work only in a certain one!

Upd: Yay! I solved it! I just clicked on the Prettier icon on the bottom and checked all the output and I found out that the output changed its look when I`ve put the last tag on and so I deleted it and saved. After that all code got formatted. I heard Prettier may not work when there is a syntax problem in your code. Not that closing html tag is a problem though: after text was formated, Prettier just put it back itself. So... thanks for all of your answers!

Karina
  • 57
  • 1
  • 9
  • Does this answer your question? [Why does Prettier not format code in VS Code?](https://stackoverflow.com/questions/52586965/why-does-prettier-not-format-code-in-vs-code) –  Sep 15 '21 at 08:02

1 Answers1

1

you need to update the VS Code. If the problem still not solved. then try to install another prettier extension might help.

this problem happened because of updates.

Aman Sharma
  • 933
  • 1
  • 4
  • 12
  • Oh thanks! I just uninstalled Prettier to install it again and it all happened again: nothing is getting formated while it all kinda works... Again, I checked all the settings after I installed it back and all seem to be good. Or maybe I did not get it right what do you mean by another prettier extension? – Karina Sep 15 '21 at 10:18
  • 1
    Actually I just realized it just doesnt work when I work in a certain folder, when I work in another ones it works fine! The same goes for "format document". – Karina Sep 15 '21 at 10:41
  • I installed 3 different prettiers, it still does not work for me on HTML file in VSCode – harshikerfuffle Jan 16 '22 at 02:31