Kimball Robinson
Kimball Robinson

Reputation: 3387

How do I set IntelliJ to place xml tags on separate lines when formatting xml files?

I'm using IntelliJ IDEA 12. I've used the context menu to import some pom.xml maven dependencies. However, when I view the POM file, the dependencies are not formatted nicely--they are in a single line. When I reformat the pom file (Ctrl-Alt-L) the formatting is still not fixed.

I tried looking at Project Settings > code style > XML, but I couldn't see an obvious setting that would fix this. I fiddled with "keep line breaks" and "wrap text" settings, but to no avail.

I have noticed that other XML files have the same issue--if I join them, formatting won't break them apart.

How can I get IntelliJ to intelligently break xml across multiple lines, with proper indentation?

Upvotes: 7

Views: 2142

Answers (1)

Kimball Robinson
Kimball Robinson

Reputation: 3387

Uncheck the option "keep white spaces" in the settings.

In IDEA 12, File > Settings > Code Style (left menu panel) > XML (left menu panel) > Other (tab) > Keep White Spaces (checkbox)

Upvotes: 3

Related Questions