Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problems with code formatting on save in vscode

I have vscode installed and also the prettier extension. In settings I select the option format on save. However, when saving the formatting of the code does not happen, I have to activate the format manually. how can I solve that ?

like image 845
Diegohp141 Avatar asked Dec 23 '25 00:12

Diegohp141


2 Answers

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"
  }
like image 58
Diegohp141 Avatar answered Dec 24 '25 16:12

Diegohp141


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
}
like image 27
Prokie Avatar answered Dec 24 '25 14:12

Prokie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!