Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code: Auto-indent on tab press to match indentation of previous line

For comparison:

In Sublime (and also Atom), if I press tab under a line of code that already has 4 tab spaces, Sublime will automatically jump to the same tab spacing of the previous line (4 tab spaces).

In VS Code – when trying to accomplish the same thing – tabs will fail to 'jump' to the previous line's spacing, and force me to manually press tab multiple times, instead of once.

Is there a work-around, or am I missing something?

Sublime, Atom - 1x tab press

enter image description here

VS Code - 4x tab press

enter image description here

like image 614
Po Rith Avatar asked Jan 26 '18 07:01

Po Rith


Video Answer


1 Answers

If you add this to your settings, you'll be able to just type out the line without watching indentation and whenever you hit enter, vscode will indent that previously written line automatically:

"editor.formatOnType": true

I know this isn't exactly what you're looking for, but I thought I might as well share and hope this is a satisfying answer.

like image 173
Mark Avatar answered Oct 22 '22 14:10

Mark