Same for me, I managed to solve it with:
{
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
}
}
This allowed me to use prettier globally and use built in html formatter for html. Also allowed the formatting to happen on save and while typing.
The part responsible for Prettier formatting html:
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
To open type
Ctrl+Shift+P, then type open user/workspace settings JSON in the command line.
Same for me, I managed to solve it with:
{
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
}
}
This allowed me to use prettier globally and use built in html formatter for html. Also allowed the formatting to happen on save and while typing.
The part responsible for Prettier formatting html:
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
To open type
Ctrl+Shift+P, then type open user/workspace settings JSON in the command line.
I got the same issue, the cause can be updating the VS Code. fixed it by setting the Default Formatter of Text Editor
Go to Settings (Ctrl+, for windows), search for 'Default Formatter'
Set the formatter in dropdown (esbenp.prettier-vscode) for prettier. this can change if you are using any other formatter.
Videos
I have Prettier setup as the default formatter already and it's working fine for JSX and JS files.
The weird thing is that it works on save, so when I save it formats HTML correctly, but if I try to do it manually I get: "Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'HTML'-files".