rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.91k stars 300 forks source link

Indenter should have setting for number of blank lines between procedures #2286

Closed ThunderFrame closed 6 years ago

ThunderFrame commented 8 years ago

My preference is for 1 blank line after a declaration, so that Types/Enums/Procedures are easier to identify visually:

Before:

Option Explicit
Type Fizz
  Foo As String
  Bar As String
End Type
Enum Buzz
  aaa =1
  bbb = 2
End Enum
Sub Foo()
End Sub
Sub Bar()
End Sub
'TODO - Refactor FooBar
Sub FooBar
End Sub

becomes

After:

Option Explicit

Type Fizz
  Foo As String
  Bar As String
End Type

Enum Buzz
  aaa =1
  bbb = 2
End Enum

Sub Foo()
End Sub

Sub Bar()
End Sub

'TODO - Refactor FooBar
Sub FooBar
End Sub
retailcoder commented 8 years ago

Technically not indentation, but I like it very much. Good idea!

comintern commented 7 years ago

Any thoughts on what would be reasonable limits on the settings for this? 0 to 5 lines between functions with a default of 1?

When I implement this I'll probably also add a setting to remove extra vertical white-space inside of procedures also. My thought is that it should be a separate setting. Something like "Compress blank lines inside of procedures" with a related setting of "Maximum blank lines".

ThunderFrame commented 7 years ago

I think 0 to 5 seems reasonable. Personally, I'd never use more than 2, and would default to 1.

Might be worth having a setting for vertical space between declarations, and vertical space within declarations, and maybe settings for leading/trailing vertical space?

retailcoder commented 7 years ago

I'd make it 0 or 1... maybe have 2 available to pick from, but 5 seems a bit arbitrary and.. well, excessive IMO.

retailcoder commented 7 years ago

@comintern should this one be closed?

comintern commented 7 years ago

@retailcoder - I'd leave it open. The only thing that's currently implemented is spacing between procedures - I'm still planning on adding support for spacing between Type and Enum members and declaration blocks.

comintern commented 6 years ago

This should have been closed quite a while ago. Already supported.