javaeclipseeclipse-marseclipse-formatter

How to force the Eclipse Mars 4.5 formatter not to join already wrapped lines?


I've just moved from eclipse Kepler to eclipse Mars and my Java formatter seems not to behave the same way anymore.

I used to be able to do the following:

object
    .method1()
    .method2()
    .method3();

The formatter would keep my code like that. However since I changed to eclipse mars, everything is wrapped to one line.

I've verified the formatter and I still have the option "Never join already wrapped lines" checked. My project doesn't use specific settings regarding the eclipse formatter. I tried recreating a formatter from scratch and the result is the same.

How can I force eclipse not to join those lines ?

Thanks


Solution

  • I found solution: I selected all specific elements (Annotations, Class Declarations, ...) and defined Wrap where necessary instead of my usual Do not wrap. I then set the maximum line width to a high value so that Wrap when necessary never actually wraps anything. That seems to be sufficient for my already wrapped lines not to be joined and keep the default behavior of the formatter to "do not wrap".

    EDIT: Even though that's a solution for the problem at hand, I've faced many more problems with Eclipse Mars's formatter that made me got back to Kepler. I tried Luna and it seems not to have the same problems. I'll probably be switching to Luna.

    EDIT: I switched to Luna and everything works fine

    EDIT: I tried the new Mars.1 and even though I do not have the exact same formatting, a lot of bugs have been fixed and it was enough for me to start using it for some projects. I'll probably be switching all my projects there in due time.