This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
It would be useful to allow for the insertion of balnak lines around comments, so that the comments can be associated with the lines to which they pertain I would suggest that the formatted should have the ability to insert and remove blank lines around comments so as to ensure that there are a specified number present. I have used formattrs athat allow for the specification of the number of lines before and after single line and multi line comments and also for /* */ style and // style comments I have sued this facility to ensure that comments are placed above the code that they relate to, and so that they can group with that code. x=1; //code note y=x; becomes x=1; //code note y=x; The setting for code block and different style of comments are to allow for different house styles
related to the indendation engine/formatter which is targetted at 3.4.
Set target milestone to TBD
Changing subcomponent to formatting.
Also see #170166
(Using NetBeans IDE 8.0.1 (Build 201408251540)) I often use comments to structure logically related parts of code. For instance: public class Test { // f methods public void f1() { } public void f2() { } // g methods public void g1() { } public void g2() { } } Unfortunately, this gets formatted into: public class Test { // f methods public void f1() { } public void f2() { } // g methods public void g1() { } public void g2() { } } Notice that the blank lines after the comments were removed. Consequently it now seems the "// f methods" comment is for the f1() method, which is of course not the intention.
(In reply to klr8 from comment #7) > > Notice that the blank lines after the comments were removed. Consequently it > now seems the "// f methods" comment is for the f1() method, which is of > course not the intention. This is how the all the java parts in NetBeans look at it, "// f methods" is a comment for method f1(). Moving, renaming, organizing members on this method will all include the comment as part of method f1().
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss