Prefer breaking on ternary operators
This commit is contained in:
parent
c1f189b124
commit
845358bb61
|
@ -1320,8 +1320,8 @@ private:
|
|||
}
|
||||
immutable l = indents.indentToMostRecent(tok!"switch");
|
||||
if (l != -1)
|
||||
indentLevel = config.dfmt_align_switch_statements
|
||||
== OptionalBoolean.t ? l : indents.indentLevel;
|
||||
indentLevel = config.dfmt_align_switch_statements == OptionalBoolean.t
|
||||
? l : indents.indentLevel;
|
||||
}
|
||||
else if (currentIs(tok!")"))
|
||||
{
|
||||
|
|
|
@ -183,8 +183,8 @@ private:
|
|||
int parenCount;
|
||||
foreach (i; 0 .. j)
|
||||
{
|
||||
immutable int pc = (arr[i] == tok!"!" || arr[i] == tok!"(" || arr[i] == tok!")") ? parenCount
|
||||
+ 1 : parenCount;
|
||||
immutable int pc = (arr[i] == tok!"!" || arr[i] == tok!"(" || arr[i] == tok!")") ? parenCount + 1
|
||||
: parenCount;
|
||||
if ((isWrapIndent(arr[i]) || arr[i] == tok!"(") && parenCount > 1)
|
||||
{
|
||||
parenCount = pc;
|
||||
|
|
|
@ -133,12 +133,13 @@ int breakCost(IdType p, IdType c) pure nothrow @safe @nogc
|
|||
case tok!"||":
|
||||
case tok!"&&":
|
||||
case tok!",":
|
||||
case tok!":":
|
||||
case tok!"?":
|
||||
return 0;
|
||||
case tok!"(":
|
||||
return 60;
|
||||
case tok!"[":
|
||||
return 300;
|
||||
case tok!":":
|
||||
case tok!";":
|
||||
case tok!"^^":
|
||||
case tok!"^=":
|
||||
|
@ -169,7 +170,6 @@ int breakCost(IdType p, IdType c) pure nothrow @safe @nogc
|
|||
case tok!"!=":
|
||||
case tok!"!>=":
|
||||
case tok!"!>":
|
||||
case tok!"?":
|
||||
case tok!"/=":
|
||||
case tok!"/":
|
||||
case tok!"..":
|
||||
|
|
Loading…
Reference in New Issue