Search code examples
javaintellij-ideaindentationcode-formattingauto-indent

How do you fix intellij strange string indentation?


Intellij keeps on formatting my strings like this, its annoying...

How do I fix it so the lines all line up?

PreparedStatement p = s.prepare(
        "select distinct resource, uid, role " +
                "from role " +
                "where person_uuid=? " +
                "order by role, resource, uid");

I.E.:

PreparedStatement p = s.prepare(
        "select distinct resource, uid, role " +
        "from role " +
        "where person_uuid=? " +
        "order by role, resource, uid");

Solution

  • You can adjust the formatting in Project Settings -> Code Style -> Java -> Wrapping and Braces. The option you are looking for should be either "Method call arguments" or "Binary Expressions"