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?
Open indentation settings in code style scheme Click the widget and select Configure Indents for 'Language'. In the dialog that opens, you can change settings for tabs and indents and also configure other code style settings. Click OK. Reformat the necessary part of your project to apply new indentation settings.
If you have some custom plugins that require you to import your project from the IntelliJ IDEA model, press Ctrl+Shift+A and search for the Project from Existing Sources action. In the dialog that opens, select the pom. xml file of the project you want to open. Click OK.
XML. XML. . IntelliJ IDEA brings powerful support for XML that includes structure validation, formatting ( Ctrl+Alt+L) and indentation ( Ctrl+Alt+I according to the XML code style, importing unbound namespaces, viewing code structure, unwrapping and removing tags ( Ctrl+Shift+Delete ), generating DTD files and schemas from instance documents, ...
If the checkbox is cleared, IntelliJ IDEA deletes the tab characters and spaces on empty lines. Use these settings to specify a margin space required on the right side of an element. If you select Default option then a value of the right margin from the global settings will be used.
Select this checkbox to have IntelliJ IDEA honor line breaks in attributes (for example, lengthy descriptions) when reviewing XML files in the editor. In this text box, specify the minimum number of sequential blank lines to be retained after reformatting. Use this drop-down list to determine how attribute lines should be wrapped.
If the checkbox is cleared, IntelliJ IDEA uses spaces instead of tabs. An indentation consists of two parts. One part results from nesting code blocks, and the other part is determined by alignment.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With