Follow theses steps and I think it is gonna work:
settings.json
file and past in the lines below. You can find settings.json
by doing so:F1
or Ctrl
+
Shift
+
P
, then type open settings
and choose Open Settings (JSON)
Shift
+
CMD
+
P
, then the same steps as Windows{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
}
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)
Edit settings.json page
I had to add the following:
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.