Home > other >  problems with code formatting on save in vscode
problems with code formatting on save in vscode

Time:12-29

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 ?

CodePudding user response:

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
}

CodePudding user response:

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"
  }
  • Related