Issue
I am using Eclipse 3.5.1 (Galileo) and am having trouble with one of the auto-formatting settings.
At the moment when I auto-format a blank line is inserted between each and every field declaration. The behaviour I'm looking for is to organise field declarations without a blank line between. Except in the case where there is already one or more blank lines between the declarations, in that case I'd like the formatter to respect the space, and reduce >=1 lines to 1 line.
I know this was possible at some point with Eclipse (can't remember the version but I have used a setting for this), but I can't seem to find the correct settings in Window->Preferences->Java->Code Style->Formatter
.
Which setting do I configure to enable this behaviour?
EDIT: It seems the behaviour I'm describing is the default, and for some reason I couldn't find a way to return to that without removing the .settings
directory. It also couldn't be reproduced, which suggests that it's something weird with the project settings (it's checked out from an open source project). Although I've found a hacky way to fix this, I'm still looking for suggestions and will be able to verify and accept an answer.
Solution
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.
Answered By - Grundlefleck