I'd like to configure the Eclipse java formatter to format chained method calls like that:
lblName
.setX(last.getX() + last.getWidth())
.setY(0)
.setHeight(this.height)
.setWidth(80);
My problem is, that I don't know how to make it only format it like this, if the first method call already is placed in the second line. This call should be untouched:
lblName.setX(last.getX() + last.getWidth()).setY(0).setHeight(this.height).setWidth(80);
You say:
...if the first method call already is placed...call should be untouched...
If you don't want the formatter to wrap already wrapped lines, have a look at this panel:
That's not possible. You can either have a line break after each method call, after a certain character limit per line, or not at all.
That said, your request is also not well thought. Writing two times the same code with differences only in line breaks (e.g. by two different people in the same team) should lead to getting the same formatted code for committing to a common repository.
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