Is there some combination of keys or a menu option that I can use to automatically format my code in Visual Studio?
In an existing project, open the document that you want to format, right-click inside the document, and select Format Document. In the default configuration for Visual Studio Code, the command can be run using the shortcut Alt+Shift+F.
To automatically format the file on save, In Visual Studio Code, press Control + Shift + P or Command + Shift + P (Mac) to open the command palette and type setting and then select Preferences: Open User Settings option. Search for format on save setting and check the checkbox.
It sounds like you want to format the entire document in Visual Studio (this feature is some times referred to as pretty printing). If so then you can use the menu command. Edit -> Advanced -> Format Document
. This is typically bound to the key stroke CTRL+KCTRL+D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With