Follow these steps:
- CTRL + SHIFT + P
- Format Document (in pop-up bar)
- Select
Format Document - Select
Configure Default Formatter... - Select
Prettier - Code formatter
Done!
Answer from Goku on Stack OverflowFollow these steps:
- CTRL + SHIFT + P
- Format Document (in pop-up bar)
- Select
Format Document - Select
Configure Default Formatter... - Select
Prettier - Code formatter
Done!
In VSCode settings, search for "Editor: Default Formatter", set it to esbenp.prettier-vscode and restart VSCode.
Hi everyone,
For the last few months the FormatOnSave feature stopped working for me.
I have editor.formatOnSave = true in my settings.json but whenever I save *.rs file nothing happens. It was working before but at some point stopped to.
Does anyone have a similar issue? Is this VSCode problem or is something probably wrong with my settings?
Thanks
Format on Save (prettier) stopped working with latest update
Prettier extension's format-on-save doesn't work anymore
Format on Save (Black) stopped working with latest update
For the life of me, I cannot get VSCode to format my code like it used to. Please help. I am losing my mind.
Videos
For the life of me, I cannot get VSCode to format my code like it used to. Please help. I am losing my mind.
I've googled and come up empty.
I've tried:
Reinstalling
Enable/disable various extensions
Went through ALL format settings suggested (default formatter, etc)
(This includes format on save, etc)
My code is in C#.
It worked perfectly fine until I had to refresh windows due to a separate issue. It removed all of my programs installed on C: and I had to reinstall VSCode. Since then, whenever I save, NOTHING gets formatted. It is a pain in the ass to format without it. Please help.
Edit: Reinstalled .NET, now C# formatter works but Prettier does not.. at least it's something, I guess?
An accurate depiction of my mental state.
EDIT: Came back to VS code randomly, without updating, and it resolves itself.
I am sorry, this is clearly a 'knowledge of the ancients' situation. If you got here via google, I am afraid I cannot help you.
Update, i just find the solution if anyone is having the same problem i have to add the following lines to user setting json
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
Press Ctrl+shift+p and type Preferences: Open User Settings (JSON). In that json file add the following line and save. This should enable so vscode formats the code each time you save.
{
"editor.formatOnSave": true
}