Code formatting of interfaces

Am I the only one who would like to have a special formatting option for interfaces?

We can choose number of blank line between methods, which is helpful in maintaining a readable layout of a class. I have chosen 2 blank lines; I wouldn't be surprised if that's the most commonly chosen value.

But this setting automatically applies to interfaces as well. Interfaces have no method bodies, only single-line method signatures. For these, I find that having 2 blank lines between each method signature just makes the interface less readable; often it stretches a fairly small interface beyond the bottom of the screen, forcing us to scroll to see the rest.

Personally, I would have liked to have an additional setting for blank lines between method signatures in interfaces. I would choose to set it to 0, but the default should off course be the same as the number of blank lines between methods in classes so that no one gets his or her code changed without first choosing a different setting for interface formatting.

Here's the original request:
http://www.intellij.net/tracker/idea/viewSCR?publicId=23817

Please let me know if this is a completely useless and stupid idea and I'll just creep back into my cave. On the other hand, should you find it appealing, why not help me convince JetBrains to fix this in 4.5 or in one of the immediate follow-ups?

Best regards,
Lars Ugleberg

2 comments
Comment actions Permalink

Am I the only one who would like to have a special formatting option for interfaces?


No, you are not alone. It would be nice, if the super Rearranger plugin
would also allow settings for interfaces and utility classes (private
constructor and all methods static and no instantiation of the class
itself).

Tom

0
Comment actions Permalink

Lars Ugleberg wrote:

But this setting automatically applies to interfaces as well. Interfaces have no method bodies, only single-line method signatures. For these, I find that having 2 blank lines between each method signature just makes the interface less readable; often it stretches a fairly small interface beyond the bottom of the screen, forcing us to scroll to see the rest.


It doesn't look so strange if you document your interfaces... :)

Please let me know if this is a completely useless and stupid idea and I'll just creep back into my cave. On the other hand, should you find it appealing, why not help me convince JetBrains to fix this in 4.5 or in one of the immediate follow-ups?


Sounds like a good idea to me. I wouldn't use it myself, but I can see that
others would.

Vil.
--
Vilya Harvey
vilya.harvey@digitalsteps.com / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/

0

Please sign in to leave a comment.