8

Is there any way I can instruct Eclipse's formatter to put each value in an array initializer on a new line?

2 Answers 2

20

You can do it this way: windows/preferences/java/code style/formatter, then near the selected active profile click edit

then on the "Line Wrapping" tab

Choose "Expressions"->"Array initializers"

Under The list choose "Wrap all elements, every element an a new line"

1

Go to windows/preferences/java/code style/formatter, then near the selected active profile click edit, then on the new lines tab there are 2 options for this.

1
  • 1
    I guess you are referring to "Array initializers" checkbox group in "Formatter" but these options only add a new line after/before the opening/closing brace. I would like to add a new line after each comma for each value in the array initializer.
    – jilt3d
    Jan 4, 2012 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.