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.
Summary: | Add comment formatting option | ||
---|---|---|---|
Product: | java | Reporter: | nco <nco> |
Component: | Editor | Assignee: | Dusan Balek <dbalek> |
Status: | NEW --- | ||
Severity: | blocker | CC: | dbotterill, gsporar |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
nco
2008-03-08 10:53:30 UTC
update issue type Again, please add more details about the functionality that you are requesting. Thanks Okay, In Tools - Options - Java Code - Formatting - Blank Lines : We can't configure the number of blank lines before or after comments. Today, if I want add an comment before a method with one blank line beetwen them, when I launch the format action, the blank line disapears. I generally use comments in class for visualy seperate the different part of code. However, there will be a difference beetwen comment block and javadoc block. I can say a little more about how I think it should work. First, Eclipse has had the ability to format comments since at least 2003. That said, I never liked how it worked in Eclipse -- my comments never wound up formatted as I would have liked. If I have a single line comment like this: // this is a really, really long single line comment that extends past the 80 character vertical line in the editor it should be reformatted as: // this is a really, really long single line comment that extends past the 80 // character vertical line in the editor because "80" fits within the 80-character vertical line, while the word "character" does not. The right margin can be changed to something other than 80 characters (Tools->Options->Editor->Indentation->Right Margin), so it should break long comments at whatever it's actually set to. I am just using the default value of 80 here as an example. Here is an example for "slash star" style comments: /* This * is a very poorly formatted comment. Some lines are really, really long while others * are not */ It should be reformatted like: /* This is a very poorly formatted comment. Some lines are really, really long * while others are not */ Javadoc comments should be handled in a similar way, although my preference would be that the slash and double star be on a line all by itself. Here's a javadoc comment before reformatting: /** This is a very poorly formatted javadoc comment. Some lines are really, really long * while * others are not. *@param foo the blah blah blah *@throws IllegalStateException if * something bad happens this exception will * be thrown */ and afterwards: /** * This is a very poorly formatted javadoc comment. Some lines are really, * really long while others are not. * * @param foo * the blah blah blah * @throws IllegalStateException * if something bad happens this exception will be thrown */ Since some will not like their comments reformatted, there should be an option to turn this feature off. I have the same issue, I have code like this: int g=0; // test int h=1; //test and when I hit alt+shift+f it formats it to look like this: int g=0; // test int h=1; //test I would really like to turn off the addition of line breaks after the // comments sgano: this is filed as separated issue 131954 and should be fixed now, the fix will be included in patch1 |