File tree Expand file tree Collapse file tree 7 files changed +38
-29
lines changed Expand file tree Collapse file tree 7 files changed +38
-29
lines changed Original file line number Diff line number Diff line change 22
33* Support triple-shift ` >>> ` and ` >>>= ` operators (#992 ).
44* Support non-function type aliases (#993 ).
5- * Less indentation on nested ` ?: ` (#713 , #722 ).
65* Correct constructor initializer indentation after ` required ` (#1010 ).
76
87# 2.0.0
Original file line number Diff line number Diff line change @@ -821,10 +821,14 @@ class SourceVisitor extends ThrowingAstVisitor {
821821
822822 @override
823823 void visitConditionalExpression (ConditionalExpression node) {
824+ // TODO(rnystrom): Consider revisiting whether users prefer this after 2.13.
825+ /*
824826 // Flatten else-if style chained conditionals.
825827 var shouldNest = node.parent is! ConditionalExpression ||
826828 (node.parent as ConditionalExpression).elseExpression != node;
827829 if (shouldNest) builder.nestExpression();
830+ */
831+ builder.nestExpression ();
828832
829833 // Start lazily so we don't force the operator to split if a line comment
830834 // appears before the first operand. If we split after one clause in a
@@ -859,7 +863,12 @@ class SourceVisitor extends ThrowingAstVisitor {
859863 builder.endRule ();
860864 builder.endSpan ();
861865 builder.endBlockArgumentNesting ();
866+
867+ // TODO(rnystrom): Consider revisiting whether users prefer this after 2.13.
868+ /*
862869 if (shouldNest) builder.unnest();
870+ */
871+ builder.unnest ();
863872 }
864873
865874 @override
Original file line number Diff line number Diff line change @@ -27,25 +27,26 @@ receiver
2727 ..formattedTotal = _total == 0
2828 ? ""
2929 : _chartType == "PieChart"
30- ? _formatter.formatAsPercent(item.value / _total, fractionDigits: 1)
31- : _formatter.formatValue(item.value, item.valueType);
30+ ? _formatter.formatAsPercent(item.value / _total,
31+ fractionDigits: 1)
32+ : _formatter.formatValue(item.value, item.valueType);
3233 }
3334>>> (indent 6)
3435main() {
3536receiver
3637 ..formattedTotal = _total == 0
3738 ? ""
3839 : _chartType == "PieChart"
39- ? _formatter.formatAsPercent(item.value / _total, fractionDigits: 1)
40- : _formatter.formatValue(item.value, item.valueType);
40+ ? _formatter.formatAsPercent(item.value / _total, fractionDigits: 1)
41+ : _formatter.formatValue(item.value, item.valueType);
4142}
4243<<<
4344 main() {
4445 receiver
4546 ..formattedTotal = _total == 0
4647 ? ""
4748 : _chartType == "PieChart"
48- ? _formatter.formatAsPercent(item.value / _total,
49- fractionDigits: 1)
50- : _formatter.formatValue(item.value, item.valueType);
49+ ? _formatter.formatAsPercent(item.value / _total,
50+ fractionDigits: 1)
51+ : _formatter.formatValue(item.value, item.valueType);
5152 }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ String type = status == 'OK'
66String type = status == 'OK'
77 ? 'notices'
88 : status == 'NO'
9- ? 'warnings'
10- : status == 'BAD'
11- ? 'errors'
12- : '';
9+ ? 'warnings'
10+ : status == 'BAD'
11+ ? 'errors'
12+ : '';
Original file line number Diff line number Diff line change @@ -20,15 +20,15 @@ Widget(
2020 child: project.locked
2121 ? Icon(Icons.lock)
2222 : project.fav
23- ? Icon(Icons.star)
24- : project.taps == null
25- ? Icon(Icons.notifications)
26- : Text(
27- suffixNumber(project.taps),
28- textAlign: TextAlign.center,
29- style: TextStyle(
30- fontSize: 18.0,
31- fontWeight: FontWeight.w600,
32- ),
33- ),
23+ ? Icon(Icons.star)
24+ : project.taps == null
25+ ? Icon(Icons.notifications)
26+ : Text(
27+ suffixNumber(project.taps),
28+ textAlign: TextAlign.center,
29+ style: TextStyle(
30+ fontSize: 18.0,
31+ fontWeight: FontWeight.w600,
32+ ),
33+ ),
3434);
Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ class C {
77 int get currentAngleDigits => _currentSunAngleDeg < 0
88 ? 1
99 : _currentSunAngleDeg < 10
10- ? 2
11- : 3;
10+ ? 2
11+ : 3;
1212}
Original file line number Diff line number Diff line change @@ -84,8 +84,8 @@ var kind = a ? b : c ? d : e;
8484var kind = a
8585 ? b
8686 : c
87- ? d
88- : e;
87+ ? d
88+ : e;
8989>>> don't split conditionals when indirectly nested
9090var kind = a ? b : (c ? d : e);
9191<<<
@@ -132,8 +132,8 @@ identifier
132132 ? someParticularlyLongOperand
133133 : someParticularlyLongOperand
134134 : identifier
135- ? someParticularlyLongOperand
136- : someParticularlyLongOperand;
135+ ? someParticularlyLongOperand
136+ : someParticularlyLongOperand;
137137>>> index expressions can split after "["
138138verylongIdentifier[someParticularlyLongArgument];
139139<<<
You can’t perform that action at this time.
0 commit comments