Please try version 2.7 and see if this fixes your problem. I have seen situations where blank space (invisible) at the ends of blank lines confused the spacing algorithm. If you still have problems, please send me the file you're trying to rearrange.
I’m still seeing the same problem in 2.7 that the force 0 lines after class close brace is not working for me, it happens with every Java file, I think you should be able to produce it by just leaving one blank line at the bottom of your class.
Thanks,
-Andre
-
Andre,
First let me tell you what I think is happening, then propose a solution.
The end of file is a special case. I always force one newline character after the final brace, so if you bring up the file in an editor like vi or transfer the file to a Unix machine, the last line is terminated with a newline. Unfortunately, IDEA's editor shows this by placing the cursor on the next line, giving the appearance of an extra line at the end of file.
The kind of spacing that 'after class close brace' would control is: 1) when there are two outer classes in one file (first is public, second is not), this controls the spacing between the two classes; 2) when there are two adjacent inner classes, again this controls spacing between the two classes.
There is a hierarchy in the way the spacing options are applied. 'After close brace' settings are overridden by 'Before class close brace' when is the last item in the containing class. I.e., the spacing between the close brace of the last method of a class and the close brace of the class itself is controlled by 'before class close brace', not by 'after method close brace'. Similarly, there is an implicit file level control, so that 'force N blank lines at end of file' overrides the 'After class close brace' setting for the last class in the file.
Here's the proposal. At the moment, N = 1 in the implicit rule 'force N blank lines at end of file.' User has no visibility or control over it. I could add another item to the Spacing UI like "Force ]]> newline characters at end of file." If you set N to zero, there will be no newline character after the final brace in the file, and it would not appear (in IDEA's editor) that there was a blank line. If you set it to one, there will be one newline character after the final brace in the file (so other editors view it properly) but IDEA's editor will give the impression of a blank line there.
Sorry for the confusion. Would you like something like this?
-Dave
PS - I'm going to copy this (leaving out mail addresses etc) to the plugins forum so other folks can see or comment. It's probably been bothering others, too. :)
Hi Andre,
Please try version 2.7 and see if this fixes your problem. I have seen situations where blank space (invisible) at the ends of blank lines confused the spacing algorithm. If you still have problems, please send me the file you're trying to rearrange.
Thanks for your patience,
-Dave
Hey Dave,
I’m still seeing the same problem in 2.7 that the force 0 lines after class close brace is not working for me, it happens with every Java file, I think you should be able to produce it by just leaving one blank line at the bottom of your class.
Thanks,
-Andre
-
Andre,
First let me tell you what I think is happening, then propose a solution.
The end of file is a special case. I always force one newline character after the final brace, so if you bring up the file in an editor like vi or transfer the file to a Unix machine, the last line is terminated with a newline. Unfortunately, IDEA's editor shows this by placing the cursor on the next line, giving the appearance of an extra line at the end of file.
The kind of spacing that 'after class close brace' would control is:
1) when there are two outer classes in one file (first is public, second is not), this controls the spacing between the two classes;
2) when there are two adjacent inner classes, again this controls spacing between the two classes.
There is a hierarchy in the way the spacing options are applied. 'After close brace' settings are overridden by 'Before class close brace' when is the last item in the containing class. I.e., the spacing between the close brace of the last method of a class and the close brace of the class itself is controlled by 'before class close brace', not by 'after method close brace'. Similarly, there is an implicit file level control, so that 'force N blank lines at end of file' overrides the 'After class close brace' setting for the last class in the file. Here's the proposal. At the moment, N = 1 in the implicit rule 'force N blank lines at end of file.' User has no visibility or control over it. I could add another item to the Spacing UI like "Force ]]> newline characters at end of file." If you set N to zero, there will be no newline character after the final brace in the file, and it would not appear (in IDEA's editor) that there was a blank line. If you set it to one, there will be one newline character after the final brace in the file (so other editors view it properly) but IDEA's editor will give the impression of a blank line there.
Sorry for the confusion. Would you like something like this?
-Dave
PS - I'm going to copy this (leaving out mail addresses etc) to the plugins forum so other folks can see or comment. It's probably been bothering others, too. :)