Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove leading whitespace in Visual Studio Code?

Are there any shortcuts, settings, or formatting in Visual Studio Code to remove the leading spaces where the code is written?

Usually these spaces appear when copying a certain block of code and then pasting it elsewhere, for example:

var variable1 = '';
var variable2 = '';
    var variable3 = '';
    var variable4 = '';
    var variable5 = '';

Fixed it would look like this:

var variable1 = '';
var variable2 = '';
var variable3 = '';
var variable4 = '';
var variable5 = '';
like image 761
Jonatas Mendes Avatar asked Oct 25 '25 07:10

Jonatas Mendes


1 Answers

Actually CTRL + SHIFT + F combination fix indention automatically. It does not need any extension. Right click and then choose 'Format Document'. It will fix all kind of indention including your problem.

like image 161
Emre Avatar answered Oct 27 '25 04:10

Emre