Adam Pierzchała
Adam Pierzchała

Reputation: 2374

Intellij idea indent on wrap

My current formatting makes too much intend when wrapping line in XML file. I get this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

but I want this

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

I tried changing continuation indent in Code Style -> General and in Code Style -> XML but none worked.

Upvotes: 5

Views: 1398

Answers (2)

Chris
Chris

Reputation: 4593

Apart from just unticking Align attributes you also have to set the Continuation indent to the desired level.

For me the default value was 8, but to get the desired outcome as per your question I had to set this to 4.

To do this go here: IntelliJIdea -> Preferences -> Editor -> Code Style -> XML -> On the tab that is labelled "Tabs and Indents"

Upvotes: 0

maba
maba

Reputation: 48065

You have to un-tick the Align attributes in order to have continuation indentation to work.

enter image description here

Upvotes: 8

Related Questions