Seif
Seif

Reputation: 1097

How to reformat XML in IntelliJ but keep attributes on the same line

So the question is simple and has many similar ones asked here but yet they don't talk about this particular point.

I like the formatting feature but I hate that it does that:

<xs:element
   name="Foo"
   type="xs:string"/>

I would prefer it indents the tags but leaves the attributes alone and I can't find out how.

Result needed:

<xs:element name="Foo" type="xs:string"/>

EDIT: Notable to say (maybe) that the file is not .xml but .xsd.

Upvotes: 1

Views: 7299

Answers (1)

streetturtle
streetturtle

Reputation: 5850

Since .xsd is and XML itself you need to change the XML formatting settitngs.

In IDEA settings (File -> Settings... or Ctrl+Alt+S) go to Editor -> Code Style -> XML and in Wrap Attributes dropdown choose Do Not Wrap.

enter image description here

Upvotes: 4

Related Questions