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"

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

Happy Coding!
-
Have Questions? Post them here!
More Posts related to HowTos,
- How to create a New Project in Visual Studio Code (VS Code)
- How to Whitelist IP Address on GoDaddy Hosting?
- CentOS Cannot find a valid baseurl for repo base7x86_64 yum
- Fix: This app is no longer shared with you error iPhone or iPad iOS
- How to check the version of NodeJS installed
- [Error] There was an error connecting to the apple id server
- Find Restroom Near Me - Closest Toilet Nearby Using Your Current Location
- How to install xz data compression software using Brew
- Steps to Delete or Deactivate Instagram Account
- How to enable line numbers in IntelliJ
- How to display line numbers in Terminal while displaying content of a file
- Unzip a Zip file from Terminal Command
- Install SonarLint on Visual Studio Code
- How to Scan iPhone for Virus? Is Antivirus it really required?
- 100+ SEO Tips to improve your website search ranking
- [fix] Editor could not be opened unexpected error: File is a directory (VS Code)
- How to Fix Spelling Errors on Microsoft Word for Mac
- How to convert byte array to String [Kotlin]
- [Fix] Error 1020 Cloudflare: Access was denied
- Command: How to scp a file to remote server location?
- What is an Authorization Code Grant? OAuth 2.0
- How to Connect to AWS Windows EC2 UI Instance from M1 Mac (Updated 2022)
- How to replace with space
- VS Code Remove Unused Imports Keyboard Shortcut
- How to rerun last command in Zsh shell
More Posts:
- [Updated] macOS 13 Ventura Supported Mac Devices List - MacOS
- [Fix] zsh: command not found: python on Mac - Python
- Robinhood unexpected server error - Android
- How to Uninstall Android Studio on Mac - Android-Studio
- See actual SharePoint error exception modify web.config - SharePoint
- Unhandled exception type InterruptedException : Java Threads - Java
- How to create an Autocomplete Android EditText Example - Android
- How to use Spotlight feature in Teams meeting to pin and highlight participant and content - Teams