undles
undles

Reputation: 43

How to get IntelliJ IDEA to make correct indentation of xml tags with attributes on multiple lines?

Code:

| - caret

<element attr1="1"
         attr2="2"
         attr3="3">|</element>

What i expect to see after pressing enter:

<element attr1="1"
         attr2="2"
         attr3="3">
    |
</element>

What i actually get:

<element attr1="1"
         attr2="2"
         attr3="3">
    |
         </element>

IntelliJ IDEA CE 11.1

Thank you for any suggestion!

Upvotes: 4

Views: 1586

Answers (2)

Michael Kay
Michael Kay

Reputation: 163587

Interestingly, neither the output you report nor the output you would like is conformant with the rules in the XSLT/XQuery specification for indentation, here

http://www.w3.org/TR/xslt-xquery-serialization/#xml-indent

which states:

Whitespace characters MUST NOT be added adjacent to a text node that contains non-whitespace characters.

The reason is that adding whitespace here could very easily make a document schema-invalid.

Upvotes: 0

CrazyCoder
CrazyCoder

Reputation: 402413

It's a known bug reported 3 years ago, please vote.

Upvotes: 2

Related Questions