Blank lines in code being removed

I have the following code (before format):

foo();

bar();


I played with the blank line / format settings, and now when I reformat the code, IDEA eats up the blank line:

foo();
bar();

I have the following set in the "Blank Lines" configuration tab (from the top down):

1 - In decl
2 - In code **
1 - Before }
0 - Before pkg stmt
1 - After pkg stmt
1 - Before imports
1 - After imports
1 - Around class
0 - Around field
1 - Around Method
0 - After class header

I reverted my scheme back to default, and reformatted, but the blank line is still being removed. This didnt happen until after I played with the config settings.
I would have thought that (**) would be the setting Im interested in here.

Can anyone else reproduce this?

Nick

6 comments
Comment actions Permalink

Ive just tried playing with the settings on a colleagues EAP build, and I cannot reproduce this just by altering the "blank line" settings (from 2 (default)) to 1, then 0, then back to 2.

0
Comment actions Permalink

Where is this setting stored?
Ive just searched all the XML files I could find, along with the project files.

0
Comment actions Permalink

Have you tried the 'Line Breaks' setting on the General
tab's 'Keep When Formatting' ?

0
Comment actions Permalink

Thats it! Thanks.

Ok, so is this expected behaviour?

If you disable the "Keep when reformating-->Line Breaks",
IDEA ignores the "blank lines in code" setting.

0
Comment actions Permalink

If you disable the "Keep when reformating-->Line
Breaks",
IDEA ignores the "blank lines in code" setting.


... which is obviously a bug. I never disabled the "keep line breaks" option, but if I did, I'd expect IDEA to keep as many lines as configured in the "blank lines in code" settings, and remove only the excess lines.

0
Comment actions Permalink

yeh, well, I think that the reformatting code, while on
the improve, is still not working as well as it should
and certainly not like in Palada.

This is not a complaint, mind you, since I think this EAP
is certainly better than Palada in many ways.

Cheers,

Bonny

0

Please sign in to leave a comment.