Skip to content

Indenter should have a line length settings. #2406

@comintern

Description

@comintern

Call it anti-side scrolling functionality. I would automatically take lines like this...

If (Right(range("B" & Start_Row).Value, 10) = "- Overhead" Or Right(range("B" & Start_Row).Value, 14) = "- Non Overhead" Or Right(range("B" & Start_Row).Value, 4) = "- WG") Then

...and automatically add line continuations with a settable target width. For example, with a target width of 120 it would do this (align continuations is on in this case):

    If (Right(Range("B" & Start_Row).Value, 10) = "- Overhead" Or Right(Range("B" & Start_Row).Value, 14) = _
        "- Non Overhead" Or Right(Range("B" & Start_Row).Value, 4) = "- WG") Then

Optionally, it should combine line continuations up to the target width. For instance @ThunderFrame's infamous example...

Sub MySub()
    Dim x1 As Integer
    Dim _
    x2 _
    As Integer
    Dim x3 As _
    Integer
    Dim x4 _
    As _
    Integer
    Dim x5 As Integer: _
    Dim x6 As _
    Integer
    Dim x7 As Integer _
        'Comment _
        as _
        integer
End Sub

...would indent to this:

Sub MySub()
    Dim x1 As Integer
    Dim x2 As Integer
    Dim x3 As Integer
    Dim x4 As Integer
    Dim x5 As Integer: Dim x6 As Integer
    Dim x7 As Integer 'Comment as integer
End Sub

Finally, it should have a setting to break up statement delimited lines, so this...

    Dim x5 As Integer: Dim x6 As Integer

...would indent as:

    Dim x5 As Integer
    Dim x6 As Integer

IIR, there used to be a technical reason for not making changes like this because of how the VB6 Smart Indenter handled undo support. Since the RD implementation current relies entirely on the VBE's undo functionality, there's no real roadblock to this kind of functionality. Also, most of the required infrastructure is already in place at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.feature-smart-indenter

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions