score:1

Accepted answer

i found a poor solution to my problem.

i went to the project and removed the .settings directory and restarted eclipse. in the process i lost all my other formatting rules of course, which is why it sucks. but the blank lines are no longer are added, and the behaviour i described is the default behaviour (probably why i was used to it).

i still hope to accept a better solution for this, i have kept the old settings around to verify any suggestions.


edit: i think i've found the problem.

for some reason, possibly related to the project settings being checked out, any settings which i selected through preferences were not actually being honoured. so although the preferences suggested by von c were right, changing to them had no effect. i had the same problem trying to change the auto-generated comments, but didn't put two and two together (what actually alerted me to this was finally seeing "argh" being generated within a comment i couldn't seem to remove :-p).

so in this case, the problem was not actually the settings, but something else within eclipse i don't even want to investigate.

score:4

strange, i cannot reproduce that behavior with my own formatter profile (eclipse3.5.1).

there was a setting back in 2003 (bug 38523) to "insert new line after each parameter if line is too long", but this has been integrated into the "line wrapping" panel a long time ago.

are you sure the newlines are not added because of a wrapping issue (due to a maximum line length too short)?

the tab "blank lines" does have an "existing blank lines" section, with a "number of empty lines to preserve" field which can be set to 1, and should address the later part of your requirements.
in that same tab "blank lines", check also the value of the "before field declarations": "1" could explain the blank lines you see.

alt text
(source: comscigate.com)


the formatter options are in the org.eclipse.jdt.ui.prefs file, which is:

  • either in your workspace (.metadata.plugins\org.eclipse.core.runtime.settings)
  • or in the .settings of your project.

you can try and empty that file to check if the problem remains. it that clear up the issue, try adding some lines into that file, up to the point where the problem comes back.

.............................. 17jan2020 just remove the blank line after first field declaration. ..............................

score:6

format-config

the eclipse i am using is:

eclipse java ee ide for web developers.
version: indigo service release 2
build id: 20120216-1857

as the picture above shows, there is a 'between import groups' under the blank lines tab and it works for me. you can check it out.


Related Query