I dont like the way the current reformatter removes blank lines in my source code. I (and surely a large number of
developers) use blank lines also to logically structure my code, and all of these spaces created for better orientation
get deleted upon each reformat.
There should be at least a checkox inside Options dialog, which would enable 'old-style-do-not-delete-my-blank-lines' mode.
Product Version: NetBeans IDE Dev (Build 070615)
Java: 1.6.0_02-ea; Java HotSpot(TM) Client VM 1.6.0_02-ea-b02
System: Linux version 2.6.12-1.1390_FC4smp running on i386;
UTF-8; en_US (nb) Userdir: /home/ms159439/.netbeans/dev
Btw, it contradicts issue #103831.
I prefer to keep blank lines. Anyway P4 imo.
I appreciate idea of making blank lines fit to a standard, but there needs to be a way to turn this off. Maybe a check
box in that options panel to 'never remove blank lines' or something. There are LOTS of places in my code where I use
blank lines to separate things (for instance, a classes final fields from the non-final ones). This just helps me
quickly see the grouping, by not really worthy of a comment.
I am using daily build 200709050000 and was getting pretty frustrated. Because the "real-time" formatter is not quite
using my settings, I am using the "Reformat Code" action a lot. In so doing I kept on wondering why certain items where
not visually separated like I thought they would be. Then I realized what was happening.
I truly believe that this is going annoy many people. If someone took the time to section their code this way and then
the IDE removed the lines and they didn't realize it, they might start throwing things.
Granted, one might say it would be better to section for code with comments, rather than blank lines. And desired blank
lines could be created with a // in front of them so the editor will not remove them. Still, for code that has been
already written, I think people are going to be upset.
Please change the priority of this issue and address it some fashion soon. I love Netbeans (especially the promise of
NB6), and I would hate for someone trying it out to get annoyed.
Now that I have some more expierence with it, it seems that it does not remove blank lines inside methods. The blank
lines that I noticed being removed were in some class level field declarations.
If this is the intended behavior (that it doesn't remove them from methods) then this is not nearly as big a deal as I
had first thought.
Fixed in the current dev build. Reformatter should preserve explicit newline.
I set all the "blank line" values in the options dialog to zero and reformatted. All blank lines in my source file
(except the ones inside a method) were removed.
Using 6.0 RC1
I just started working with NB6 and this and related reformatting issues was the first thing I noticed. Existing code
that over the years had been hand formatted to f.i. emphasise correlation between methods and/or members by inserting
blanks, definitly lost quality by reformatting. The same is true for other reformatting issues. I think the problem is
that if everything is formatted to the same uniform rules, nothing stands out anymore. Our in-house coding rules do
allow for instance to use a "compact" lay-out for a member with its associated get/set methods. Typically a compact
block of three lines is sufficient for the member, the get/set methods and their javadoc. Reformatting now inflates
that into ten or thirteen lines (depending on whether separating blank lines are used or not). I do appreciate the
effort that has gone into the improved formatting, but it would be nice to be able to more selectively enable/disable
individual formatting rules.
Raising to P3...
My preferred spacing is:
Netbeans removes most of these blank lines, although some are configurable.
Maybe the option should be "at least X lines" between things. That way, if I add a line for readability, it is not
removed by the reformatter.
moving opened issues from TM <= 6.1 to TM=Dev
*** This issue has been marked as a duplicate of 116078 ***
This bug has not been resolved, and is not a duplicate of bug 116078. There is still no way to have the formatter preserve new lines e.g. between groups of fields.
Fixed in jet-main.
*** Bug 227310 has been marked as a duplicate of this bug. ***