Format Code in Visual Studio - VS Code [Mac/Windows/Linux]


In order to format code in Visual Studio Code (VS Code) you can make use of the below keyboard shortcuts depending upon which operating system you are working on,


1. Using Keyboard Shortcuts

Windows

Shift + Alt + F

Mac (macOS)

Shift + Option + F

Ubuntu (Linux)

Control + Shift + I

2. Using Menu Option

Simply right-click on your file/document and select the option "Format Document"

Format Document in VS Code

3. Using the VS Code Palette

  • Press Keys Command + Shift + P on Mac (Control + Shift + P on Windows) to open Palette.
  • Now Search for Format Document
Format Code using VS Code Palette

Happy Coding!

-




Have Questions? Post them here!