-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
Description
When using clang-format I found that the lacking of ternary operator styling options kinda of a bummer.
Ternary operators just format as the following code:
bool test = 10 > 6 ? true : false;Support for the following sub-options under a top level options like Break Ternary Operator would be appreaciated
Break Before Operators
bool test = 10 > 6
? true
: false;Break Before Condition Operator Only
bool test = 10 > 6
? true : false;Break After Operators
bool test = 10 > 6 ?
true :
false;Break After Condition Operator Only
bool test = 10 > 6 ?
true : false;New Option
Break Semicolon when Enable Ternary Operator Break is true
bool test = 10 > 6 ?
true :
false
;New Option
Wrap Ternary In Parenthesis, no idea about the value names for the following options
bool test = (10 > 6 ?
true :
false);bool test =
(10 > 6
? true
: false);bool test = (
10 > 6
? true
: false
);Also, create a AlignTernaryOperands aside from AlignOperands to achieve:
bool test =
10 > 6
? true
: false;
}This is the styling I go for personally
bool test = (
10 > 6
? (
1 >= 0
? true
: false
)
: false
);