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 255313 - Allow to define different blank lines rules when certain conditions are met
Summary: Allow to define different blank lines rules when certain conditions are met
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-16 07:03 UTC by SebastianZ
Modified: 2015-09-16 07:06 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SebastianZ 2015-09-16 07:03:47 UTC
You may want to define different blank line rules under certain conditions.

E.g. You may want to have a blank line after a function, but not when it's at the end of a class. 

Example:

class Example {
  public function function1() {
  }
  public function function2() {
  }
}

will currently be formatted to:

class Example {
  public function function1() {
    
  }

  public function function2() {
    
  }

}

though should be formatted to:

class Example {
  public function function1() {
    
  }

  public function function2() {
    
  }
}

This use case may be covered by introducing a 'Between Functions' option as described in bug 238894 or by changing the behavior of 'Before Class End' to overwrite the setting for 'After Function'.

Though this could be solved more generally by allowing to define conditions, so other use cases can be covered, too.

So you may want to have two blank lines before a class but only one when it's at the beginning of a PHP block.

Example:
<?php
class Class1 {
}
class Class2 {
}

currently becomes:

<?php


class Class1 {
}


class Class2 {
}

though may be expected to become:

<?php

class Class1 {
}


class Class2 {
}

To achieve that, a condition needs to be added to each option, and an additional number input field for the case the condition is met.

So this may look like:
After Function  [ 2 ] [But at end of class]      [ 0 ]
Before Class    [ 2 ] [But at beginning of file] [ 1 ]

Sebastian