Eclipse Code Format Behavior

My apologies if I am missing something obvious, but there is something that really bothers me about formatting Eclipse code. I don't want it to make any lines of code longer but shorter. Is there a way to force the behavior to be formatted this way?

Example 1:

if (somethingIsTrue() || somethingElseIsTrue()) {
  //-- Do Something.
}

      

Example 2:

if (somethingIsTrue() ||
    somethingElseIsTrue()) {
  //-- Do something.
}

      

I don't want the formatter to touch any of these blocks of code. For now, it will always expand on the second example to match the first. I do not want it.

Any ideas?

+2


source to share


1 answer


If it's Java, under Preferences.Java.Code Style.Formatter

and then in tab Line Wrapping

the checkbox is checked Never join lines

. It's worth trying ...



+7


source







All Articles