How can I format code in Visual Studio Code in the last update on Windows.
I tried Ctrl+ K, Ctrl + D doe
Formatting any document in Visual Studio Code requires one to install a formatter plugin, like Prettier - Code formatted by Esben Petersen.
Install the plugin: Prettier - Code formatter from the Extensions window in Visual Studio Code.
Post installation, from the required page you can try the below
The document should now be properly formatted.
- PS: You can set "Prettier - Code formatted" as the default formatter for Visual Studio Code by performing the following:
- Open Settings by pressing Ctrl + , and search for
editor.defaultFormatter
. Chooseesbenp.prettier-vscode
from the list and Save. By default, now formatting any document with the above steps will use Prettier as the default formatter.