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.
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 :
- Install prettier from the extensions store :
- Go and edit
settings.json
file and past in the lines below. You can findsettings.json
this way :
- On Windows :
F1
orCtrl
Shift
P
, then typeopen settings
and chooseOpen Settings (JSON)
- On MacOS :
Shift
CMD
P
, then the same steps as Windows
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
}
- Restart VS Code.