Po Rith
Po Rith

Reputation: 549

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

Upvotes: 11

Views: 1036

Answers (1)

Mark
Mark

Reputation: 151

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.

Upvotes: 1

Related Questions