visual-studio-codeindentation

How to indent/format a selection of code in Visual Studio Code?


I want to indent a specific section of code in Visual Studio Code.

I read How do you format code in Visual Studio Code? that gives shortcuts to indent the whole code, but it doesn't work when selecting a specific section of code.

I tried Ctrl + Shift + F after selecting some line in my code, but the whole file is indented. I'm on Windows with Visual Studio Code Insider 1.8.0. How can I do it?


Solution

  • I want to indent a specific section of code in Visual Studio Code:

    If you want to format a section (instead of indenting it):