Home > other >  Why Prettier code formatter stopped formatting in VS Code?
Why Prettier code formatter stopped formatting in VS Code?

Time:02-02

I am trying to format the code but the prettier isn't working fine with VS code. I also tried to reinstall it but the same problem occurs. I am not able to format my html css code with prettier. You can also see the screenshot where the code is not formatted after saving the code.

enter image description here

CodePudding user response:

If you apply the steps mentioned in the below answer (by yousoumar) , and still got no solution, then there may be an error that prettier is catching. You can always check for that by clicking on the bottom right corner, where it says prettier (tho if there are two small check marks, then there's probably no errors at all)

CodePudding user response:

Follow theses steps and I think it is gonna work :

  1. Install prettier from the extensions store :

enter image description here

  1. Go and edit settings.json file and past in the lines below. You can find settings.json this way :
  • On Windows : F1 or Ctrl Shift P, then type open settings and choose Open Settings (JSON)
  • On MacOS : Shift CMD P, then the same steps as Windows
{ 

  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  
}
  1. Restart VS Code.
  •  Tags:  
  • Related