- Notifications
You must be signed in to change notification settings - Fork 316
Description
Justification
I was reading the python PEP 8 style guide, and noticed something that could apply equally well to VBA code. The guidelines include instruction on whether to insert line breaks before or after a binary operator - you can read some justification there, but I think ultimately the look is really nice, and I believe this is a stylistic guideline that VBA developers should adhere to as well.
The smart concat feature currently places operators at the end of a line, before the line break _ character. I would propose moving them to the beginning of the subsequent line.
Description
Here's what I get at the moment:
Err.Description = "This is a very long sentence " & _ "with lots of linebreaks, to " & _ "demonstrate the smart-concat " & _ "feature"And here's what I would propose:
Err.Description = "This is a very long sentence " _ & "with lots of linebreaks, to " _ & "demonstrate the smart-concat " _ & "feature"With the multiline smart-concat (ctrl+enter) I'm in split minds as to the placement of vbNewLine following this change
Err.Description = "Invalid timer function supplied; timer functions must be one of:" & vbNewLine _ & " - a TIMERPROC pointer" & vbNewLine _ & " - an ITimerProc instance" & vbNewLine _ & " - a class name String" Err.Description = "Invalid timer function supplied; timer functions must be one of:" _ & vbNewLine & " - a TIMERPROC pointer" _ & vbNewLine & " - an ITimerProc instance" _ & vbNewLine & " - a class name String"I'd probably slightly favour the former (possibly that's just because I'm used to it as the current way of doing things), however I think it's definitely an improvement on having the & operator before the linebreak.
Additional context
Worth noting that this plays nicely with the smart indenter provided the "Ignore operators" setting is unchecked