Does anybody know how to turn line breaking in eclipse after you press CTRL + SHIFT + F
(code format), ex :
System.err
.println
The default line wrapping in Eclipse is really rather irritating and the main reason why is that the 'line width' is set as 80 characters, clearly a hangover from the nineteen eighties. This really should be updated now that everyone uses high resolution monitors instead of 80 char wide punch cards.
You probably don't want to turn it off entirely but instead you want to change the 'line width' to something more sensible (otherwise when you use the auto formatter you may get lines of code that go on forever).
I would suggest a value of 140, which seems to work nicely for most of us now using 1080p monitors.
In order to do this you need to...
With-in Preferences
, navigate to...
> Java
> Code Style
> Formatter
You can't edit the default profiles so you have to hit New...
and type a name like 'Eclipse 140 Line Width' for your profile and OK
.
Then Edit
the profile
Change to the Line Wrapping
tab
Change the Maximum Line width
from 80 to 140.
Then OK
your way out.
If you then want to fix up your existing code, select your target code and use the Source > Format
menu option.