Blank Line Configuration about Java Code Style

Hello,
I need to keep formatting of property declarations as what I left. I've tried Idea 13 and uninstalled it and now installed Intellij Idea12 Build IU173.12. After that downgrade, Code Style settings become a bit different.
I'm putting a blank line between those 2 statments:

private static final String A= "a";
private static final String B = "b";


Formatting code trims the line between them. I don't want formatter to change the declarations. If I change Code Style->Java->Blank Lines->Around Field to 1, then Idea puts a line between each field as it implies.
What I want to Idea is, not formatting declarations. If I put a line between them, keep it, or if didn't put a line between them, keep it too.

As far as I remember, I don't have an issue like this before.
Thanks.

3 comments
Comment actions Permalink

Hello.

Please try Settings / Code Style / Java / Blank Lines / Keep Maximum Blank Lines / In declarations = 1.

These "keep" settings are exactly for preserving formatting, not for changing.

Regards,
Alexander.

0
Comment actions Permalink

Thanks Alexander but I don't think it works.
I'm sending the scrreenshot of style settings. Would you guide me to update required fields?
Thanks.



Attachment(s):
ideaStyle.GIF
0
Comment actions Permalink

Yes, I'm talking exactly about these settings, and they work for me.

E.g. let I have this:

-----

@SuppressWarnings("HardCodedStringLiteral")
public class LineKeeper {
    private static final String FIRST = "first";

    private static final String SECOND = "second";
    public void context() {
    }
}

-----

Do format with settings you have shown: the empty line is inserted before the method (Ok), and the empty line between fields is not erased.

Is that the requirement? Does shown snippet work differently for you?

Regards,
Alexander.

0

Please sign in to leave a comment.