Jonatas Mendes
Jonatas Mendes

Reputation: 63

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 = '';

Upvotes: 4

Views: 8157

Answers (1)

Emre
Emre

Reputation: 41

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.

Upvotes: 2

Related Questions