IMB
IMB

Reputation: 15889

Auto insert newline on interface methods in Netbeans 10?

How can I set the auto-format feature (Alt+Shift+F) to insert a newline on interface methods in Netbeans 10? E.g.,

enter image description here

As you can see the new line only works in class definitions (class Foo2) but not in interfaces (interface Foo1).

Can't seem to find the right setting at Options > Editor > Formatting > PHP > Blank Lines

Upvotes: 0

Views: 660

Answers (1)

skomisa
skomisa

Reputation: 17343

I can't find a way to do exactly what you want, but it is possible to format the code to insert a blank line between public function bar1(); and public function bar2(); by setting Tools > Options > Editor > Formatting > PHP > Blank Lines > Before Function to 1, and After Function to 0.

However, the (possibly unwelcome) side effect is that you will get a blank line before every function, so formatting your file with those settings results in this:

phpSource

I'm guessing that you don't want the formatting to insert blank lines on line 5 and line 13 in the screen shot above, but I don't see how to prevent that while also having a blank line on line 7.

FYI, here are all the settings specified for Tools > Options > Editor > Formatting > PHP > Blank Lines:

formatSettings

Upvotes: 1

Related Questions