Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically indent within XML tag in Visual Studio Code?

I'm in the process of migrating from Sublime Text to Visual Studio Code. There's one feature that I'm missing and have been unable to work out how to achieve.

In Sublime Text, if I'm editing XML and have the cursor between a start/end tag (where the cursor is represented by |:

  <p>|</p>

Hitting enter inserts a blank line between the tags and indents like so:

  <p>
    |
  </p>

In Visual Studio code, the same action just inserts a newline and indents the closing tag:

   <p>
  |</p>

Is there any way of achieving the same effect as in Sublime?

like image 257
Paul Butcher Avatar asked Jan 21 '26 03:01

Paul Butcher


1 Answers

To answer my own question: There seems to be no way to achieve this in Visual Studio Code outside of creating a plugin.

As it happens, I've switched to Atom, which seems to have made much better choices in this area (for my purposes at least).

like image 73
Paul Butcher Avatar answered Jan 23 '26 19:01

Paul Butcher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!