The default Eclipse formatter formats my Java code in a really funny way.
For example: hello.show().x().y()
would oddly be formatted as x()
and .y()
, and be placed on a separate line.
Are there any other basic formatters that can do a better job?
Examples and links are very welcome.
I always change the formatter in Eclipse to Java Convention AND change the tab policy to always use space instead of tab or mixing of tab and space. Sometime I change also the line width to be 100 or 120 (80 characters is just too narrow in my monitor).
Regarding your specific request: yes you can change this behavior. Go to the Formatter preference and create your own profile. Modify it on tab Line Wrapping and uncheck Prefer wrapping outer expressions (keep nested expression on one line)
.
More information on: https://bugs.eclipse.org/bugs/show_bug.cgi?id=313524