Note that there are some explanatory texts on larger screens.

plurals
  1. POCan Eclipse Formatter Wrap Where Necessary, Every Element on a New Line?
    primarykey
    data
    text
    <p>I'm tying to figure out how I can customize the Eclipse code formatter to break lines more to my liking. I'm trying to set the style for parameter lists, either in method declarations or calls. Looking for a mix of <code>Wrap where necessary</code> and <code>Wrap all elements, every element on a new line</code>. I want to <code>Wrap where necessary, every element on a new line</code>, which doesn't seem to exist. My logic is that no break is necessary for short lines, my eye can scan the parameter list horizontally:</p> <pre><code>public void myMethod(int p1, int p2, int p3) { </code></pre> <p>But for lists that do need to be broken, I would like every element on a new line, so I can scan vertically:</p> <pre><code>public void myMethodWithALotOfParams( ReallyLongClassName param1, AnotherLongName aLongParamName, int p3) { </code></pre> <p>I can't seem to make this happen. I can wrap everything, including short lists. I can wrap only long lines, and continue stacking parameters on each line until I reach the margin. I can't trigger wrapping on long lines, then put each parameter on its own line.</p> <p>This style can be seen in several places in Code Complete (2nd Ed).</p> <p>UPDATE >></p> <p>I don't think there is anything built in to Eclipse to handle this, but I'm not afraid to write code. :) Eclipse is open source, so I tried to find the code that handles formatting, in hopes of building in the preferred behavior. Didn't have much luck on the first try, lots of abstraction, not much parsing and formatting. Hints?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload