Indent code in Visual Studio Code

6

How to create a shortcut to make spaces equal between assignments?

Ex:

$nome = "Maria Ferreira";
$telefone = "99645876";

To

$nome     = "Maria Ferreira";
$telefone = "99645876";
    
asked by anonymous 23.07.2018 / 14:57

2 answers

8

Natively I do not know which shortcut to do this.

But I use the extension Better Align that does just that and you can set the shortcut you want on your keyboard. link

Go to File > Preferences > Keyboard Shortcuts And create your shortcut like this:

{ "key": "ctrl+alt+i",  "command": "wwm.aligncode",
                           "when": "editorTextFocus && !editorReadonly" }

The above link has full documentation.

    
23.07.2018 / 15:03
0

To indent the code, use Alt + Shift + F .

    
22.10.2018 / 19:27