[quote=22221:@Jeremy Cowgar]I do not pad parens, but I am adding the option to my format code (a better replacement for Standardize Format). I understand simple cases such as:
SayHello( "World" )
But what do you paren padders do with something like:
a = ((b * Abs(c)) / d)
Would that wind up looking like:
a = ( ( b * Abs( c ) ) / d )
?[/quote]
For me: Space on outside of parens only
a = (b + c) * d
No space between multiple sequential parens of the same type
a = ((b + c) * (d - (e / f)))
dim a as integer=20*((3 +4)+abs(c))
for i as integer=0 to 90
DoSomething
next
Dim a As Integer = 20 * ((3 + 4) + abs(c))
For i As Integer = 0 To 90
DoSomething
Next
(and a whole lot more corrective actions).
You can then set some parameters at the top such as: PadParens = True
CaseConversion = kUpperCase
and the above will turn out as
DIM a AS INTEGER = 20 * ( ( 3 + 4 ) + abs( c ) )
FOR i AS INTEGER = 0 TO 90
DoSomething
NEXT
There is also kLowerCase and kTitleCase. Seems that I need to rethink my PadParens option and two, PadInnerParens and PadOuterParens then it will be configurable to fit most peoples coding standards. One did mention having no spacing anywhere, I could provide an option NoSpace but I wonder how many people would use it?
Spaces between operators and operands, parentheses around the parameters of methods, no spaces between method names and the opening parenthesis, no spaces between nested parentheses:
[quote=22330:@Andrew L.]Spaces between operators and operands, parentheses around the parameters of methods, no spaces between method names and the opening parenthesis, no spaces between nested parentheses:
a = ((b * Abs(c)) / d) + 1
All other styles are evil and wrong, of course ;)[/quote]
That’s how it works right now, I call that “Standard” formatting, so I’m with ya
Within reason, I’d like to make Format Code handle a variety of options. So, post a snippet of some code showing how you format. I’m not sure you can get more spacey than:
a = ( ( Abs ( x + 20 ) * 18 ) / 12 ) + 2 + Floor ( y )
Well, you could do assignment alignment and also inline comment alignment, which I am planning to support
AssignmentAlign = Bitwise.BitAnd(kAs, kEqualSign) // Could also be kNone, kEqualSign and kAs
InlineCommentColumn = 40
Dim a As Integer = 20
Dim lastName As String = "Doe"
Dim firstName As String = "John"
a = a + 18 // Add 18 to a
a += 18 // Add 18 more to a