Reputation: 49
I recently installed prettier (V9.0.0) in VS Code and enabled format on save.
This is working in CSS files but doesn't work in JS or HTML files. Has anyone had this problem and fixed it?
Not sure what other context to provide but happy to provide anything else that might be helpful.
Thanks.
Upvotes: 3
Views: 10179
Reputation: 21
Open the command palette : command + shift + p (Mac) tape : "Preferences : open User Settings (JSON)" add the following line to the json file :
"[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }
Upvotes: 2
Reputation: 1
For me only html formatting did not work. I just type this in settings:
@id:editor.defaultFormatter @lang:html formatter
and there in list you need to choose prettier.
Upvotes: 0
Reputation: 81
Try adding this in your vscode's settings.json,
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
Upvotes: 7
Reputation: 3171
This has been discussed in the past. Few things you can try:
Upvotes: 2