Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to format source code in Visual Studio Code (VSCode)

    How to format source code in Visual Studio Code (VSCode)

    By RahulSeptember 9, 20222 Mins Read

    Code formatting is essential for developers. A formatted code is easy to understand for other developers and allows us to find issues within the source code quickly. This article will help you to format source code in Visual Studio Code (VSCode) editor on various operating systems.

    Advertisement

    VSCode – Code Formatting Keyboard Shortcuts

    You can format code using the keyboard shortcuts. Use the following key combinations to format code in Visual Studio Code (VSCode).

    • Shift + Alt + F : Windows Users
    • Shift + Option + F: macOS Users
    • Ctrl + Shift + I: Linux Users

    VSCode – Code Formatting Option #2

    You can also format code using the options. Right-click on your source’s code content and select the format document. In this way the VSCode will select the default formatted for that language.

    If you have multiple code formatter extensions installed for a specific language, you need to click the “Format Document With…” option on the right click. Then select the appropriate formatter.

    how to format source code in visual studio code
    Code formatting in visual studio code

    VSCode – Installing code formatters

    When you press the formatting shortcut but no formatter is installed for the specific programming language, You will see a popup like the below:

    how to format source code in VSCode
    Installing source code formatter extension

    Click the “Install Formatter…” button, this will search for the available code formatting extension for that programming language. You can install any formatting extension of your choice that supports your language.

    visual studio code vscode
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    sleep Command in Linux with Examples

    20 Basic Linux Commands for the Beginners (Recommended)

    tail Command in Linux with Examples

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • 11 Practical Example of cat Command in Linux
    • sleep Command in Linux with Examples
    • 20 Basic Linux Commands for the Beginners (Recommended)
    • tail Command in Linux with Examples
    • What is a Orphan Process in Unix/Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.