Java formatter: Builder pattern with subbuilders

已回答

Hi,

 

Consider following bit of code:

 

Object = new ObjectBuilder()
    .editOrNewSubObject()
        .withProperty()
        .withAnotherProperty()
    .endSubObject()
    .withTopProperty()
    .build()

 

I'm trying to configure IntelliJ autoformatter to increase indent for lines after .editOrNew.* and decrease indent level for lines after calls to .end.*

 

Is it possible using autoformatter? (Or at very least, is it possible to forbid the autoformatter from reformatting custom formatting in this case?)

All of our other formatting rules are enforced through checkstyle and checkstyle import plays along nicely, except for the case of this one.

0

Please submit a request at https://youtrack.jetbrains.com/newIssue?project=IDEA. Attach a sample project to reproduce the formatting issue.

Code formatting can be disabled using special comments in the code: https://stackoverflow.com/questions/3375307/how-to-disable-code-formatting-for-some-part-of-the-code-using-comments.

0

请先登录再写评论。