For those digging for the continuator badge, line continuations are a secret weapon, but a line that contains nothing other than a line continuation is redundant, and should be removed to improve readability.
_
_
Option _
_
Explicit _
_
_
' ^ End of Option Explicit Statement
Note that the trailing line continuation, by definition, includes the blank line after the last line continuator.
Could, at a minimum, be rewritten as:
Option _
Explicit
' ^ End of Option Explicit Statement
This could be an inspection, but also be an indenter setting, so that it's taken care of on indent.
Is there a badge for breaking syntax highlighting on GitHub? :imp:
Did we ever discuss an indenter option to reformat line continuations? It seems like in the case of the indenter, a more general approach might be of more use.
I was thinking of something more along the lines of a "target" or "preferred" column width. For example, if your target column width was a GitHub friendly 95 then this...
Sub Foo()
Dim example As String
example = "This line has " & _
"a bunch of " & _
"short continuations."
End Sub
...would recombine in the indenter to:
Sub Foo()
Dim example As String
example = "This line has a bunch of short continuations."
End Sub
Similarly, this...
Sub Bar()
Dim example As String
example = "This line is likely much to long to be on one line without line continuations. Really, do you want to have to side scroll to see the end of it?"
End Sub
...would "auto-wrap" to the more readable...
Sub Bar()
Dim example As String
example = "This line is likely much to long to be on one line without line continuations. " & _
"Really, do you want to have to side scroll to see the end of it?"
End Sub
The same code would re-write your example as Option Explicit.
Ref #2406
Most helpful comment
Did we ever discuss an indenter option to reformat line continuations? It seems like in the case of the indenter, a more general approach might be of more use.
I was thinking of something more along the lines of a "target" or "preferred" column width. For example, if your target column width was a GitHub friendly 95 then this...
...would recombine in the indenter to:
Similarly, this...
...would "auto-wrap" to the more readable...
The same code would re-write your example as
Option Explicit.