0

I'm used to long lines, 160 chars, because I like Monospace fonts and I have a wide LCD screen.

The problem is, that the Code Style formatter doesn't support "hard return" as far as I know.

Such a long lines are not convenient for all cases, it is good for long function definitions with Generics parameters that throws a lot of exceptions, but it is not good for something like this :

boolean success = toBool(new WebDriverWait(driver, entities.size() * interval).until(allSucceedOrFail(entities.size(), By.className(uploadSuccessCN),
                By.className(uploadErrorCN))));

Does anyone have an idea how to workaround this ?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
lisak
  • 21,611
  • 40
  • 152
  • 243

1 Answers1

1

The Java code formatter is highly configurable, but I am not sure whether what you seek is possible. In any case, if it is at all possible, it is located in "Window > Preferences > Java > Code Style > Formatter". In that window, clic the "Edit" button.

What you seek is located on the "Line Wrapping" tab. For example, to split the line you gave as an example, you can select "Function Calls" in the list on the left, then "Wrap all elements, every element on a new line" to force it to be split... You should be able to achieve something like you want with the options in there.

Kellindil
  • 4,523
  • 21
  • 20
  • Yeah I was playing with those options for a while and then I figured that it must be decided by a programmer himself. It just didn't look natural no matter how I set it up. – lisak Jun 07 '11 at 14:33
  • @lisak : you can also turn off the fomatting for specific portions of code if there are places where you don't like the automatic formatting (see http://stackoverflow.com/questions/5115088/turn-off-eclipse-formatter-for-selected-code-area/5115143#5115143)... then again, it truly is up to each individual developper's tastes. – Kellindil Jun 07 '11 at 14:51
  • using these formatting annotations is also not acceptable. It has specific use cases, standard java development is definitely not among them. As I think about it, even the hard return wouldn't be possible to use when coding :-) – lisak Jun 07 '11 at 16:16