Reputation: 4905
is there any way to auto-format HTML and Javascript code on saving in Visual Studio like Visual Studio Code?
Upvotes: 24
Views: 25755
Reputation: 3892
Since Visual Studio 2022 17.1
there is a builtin Feature to run code formatting on save (see devblogs.microsoft), meaning there is no need to install extensions like Format document on Save
.
Be aware that there is a failure regarding the merge view when using the autoformat option - github code cleanup - merge bug.
Upvotes: 36
Reputation: 3374
The plugin Format document on Save seems to to do what you ask:
Enables auto formatting of the code when you save a file. Visual Studio supports auto formatting of the code with the Ctrl + E , D or Ctrl + E , F key shortcuts but with this extension the command
Format Document
is executed on Save.
Upvotes: 8