[java] How can I get eclipse to wrap lines after a period instead of before


0 Answers

Try this.

Window > Preferences > Java > Code Style > Formatter > Edit > Line wrapping > Function Calls, set the 'Line wrapping policy' as 'Wrap all elements, every element on a new line'.

If found already then cool.

Question

I've looked throughout Preferences -> Java -> Code Style -> Formatter and can't find any way to get eclipse to format my code like:

something.
    someMethod().
    anotherMethod().
    lastMethod();

Instead of:

something
    .someMethod()
    .anotherMethod()
    .lastMethod();

I know that's non-standard, but that's what I need.

Edit: This is not about getting lines to wrap. It's specifically about where the wrap happens in relation to the period. I want the period at the end of the line, before the newline and right now eclipse wants the period at the start of the next line.

Edit2: Even if I could find out where eclipse's source code it decides where to wrap the line, that might help. I think it might be in the JDT project, but I'm not 100% and there's a lot in there.




Related