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.

Bug 227310

Summary: Missing feature "preserve x number of empty lines"
Product: editor Reporter: StanKurdziel
Component: Formatting & IndentationAssignee: Dusan Balek <dbalek>
Status: RESOLVED DUPLICATE    
Severity: normal CC: hmichel, jkovalsky, misterm, rodrigorsantos
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description StanKurdziel 2013-03-11 18:57:27 UTC
Eclipse has a feature allowing the formatting spec to allow a certain number of blank lines.  Window->Preferences, Java->Code Style->Formatter, Edit Profile: Blank Lines tab, "Number of empty lines to preserve"

This allows the developer to format their code in the most readable manner, while still enforcing formatting rules.

A simple example is:

class Car {
  String name;

  @Getter
  Color color;  

  double rightWheelSpeed;
  double leftWheelSpeed;
}

Netbeans settings only allow forcing a space before or after ALL fields, or forcing no spaces between ALL fields. However, it's common java style to have groups of fields with no spaces inside the group and spaces between groups. In the example class above, it's much less readable to force a space between the right and left speed variables. It's also can be much less readable to remove the space above annotations for variables that have annotations.

Allowing the user to maintain up to a certain number of spaces (I've always had mine set to 1), without forcing those spaces, results in the most readable code, and prevents the desire to not use the formatter.
Comment 1 Michel Graciano 2013-05-21 19:37:03 UTC
It is one feature that I really would enjoy to see implemented :)
Comment 2 Michel Graciano 2013-06-28 17:57:08 UTC
Guys, it is already implemented for 7.4. There is two new options named 'Maximum Blank Lines' which already cover this issue IMO. Could someone close this, hopefully pointing to the fixed issue?
Comment 3 Michel Graciano 2013-06-28 18:16:13 UTC
Finally found it. Thanks Dusan :-)

*** This bug has been marked as a duplicate of bug 106815 ***