40 columns | | |

>>> split collection before for | |

var list = [for (a in b) somewhatLongThingHere]; | |

<<< | |

var list = [ | |

for (a in b) somewhatLongThingHere | |

]; | |

>>> one line in multi-line | |

var list = [veryLongThingThatForcesASplit, for (a in b) 2, 3]; | |

<<< | |

var list = [ | |

veryLongThingThatForcesASplit, | |

for (a in b) 2, | |

3 | |

]; | |

>>> long body forces split | |

var list = [1, for (a in b) veryLongThingThatForcesASplit, 3]; | |

<<< | |

var list = [ | |

1, | |

for (a in b) | |

veryLongThingThatForcesASplit, | |

3 | |

]; | |

>>> split inside body | |

var list = [1, for (a in b) veryLongThingThatForcesASplit + anotherLongThing, 3]; | |

<<< | |

var list = [ | |

1, | |

for (a in b) | |

veryLongThingThatForcesASplit + | |

anotherLongThing, | |

3 | |

]; | |

>>> trailing comma | |

var list = [for (a in b) 2,]; | |

<<< | |

var list = [ | |

for (a in b) 2, | |

]; | |

>>> spread list inside for stays on one line if it fits | |

var list = [for (a in b) ...[1, 2]]; | |

<<< | |

var list = [ | |

for (a in b) ...[1, 2] | |

]; | |

>>> spread list inside for formats like block if it splits | |

var list = [for (a in b) ...[1, 2,]]; | |

<<< | |

var list = [ | |

for (a in b) ...[ | |

1, | |

2, | |

] | |

]; | |

>>> a split collection that isn't spread wraps and indents | |

var list = [for (a in b) [1,2,]]; | |

<<< | |

var list = [ | |

for (a in b) | |

[ | |

1, | |

2, | |

] | |

]; | |

>>> lambda inside body | |

var list = [for (a in b) () { body; }]; | |

<<< | |

var list = [ | |

for (a in b) | |

() { | |

body; | |

} | |

]; | |

>>> nested for doesn't split if it fits | |

var l = [for (a in b) for (c in d) t]; | |

<<< | |

var l = [for (a in b) for (c in d) t]; | |

>>> split collection before nested for | |

var list = [for (a in b) for (c in d) longThing]; | |

<<< | |

var list = [ | |

for (a in b) for (c in d) longThing | |

]; | |

>>> just split outer for | |

var list = [for (a in b) for (c in d) longThingThatIsLong]; | |

<<< | |

var list = [ | |

for (a in b) | |

for (c in d) longThingThatIsLong | |

]; | |

>>> split in for-in type | |

var list = [for (LongGenericTypeName<TypeArg, AnotherTypeArgument> a in b) body]; | |

<<< | |

var list = [ | |

for (LongGenericTypeName<TypeArg, | |

AnotherTypeArgument> a in b) | |

body | |

]; | |

>>> split in for-in expression | |

var list = [for (a in sequenceExpression + thatDoesNotFit) body]; | |

<<< | |

var list = [ | |

for (a in sequenceExpression + | |

thatDoesNotFit) | |

body | |

]; | |

>>> split in for var type | |

var list = [for (LongGenericTypeName<TypeArg, AnotherTypeArgument> a = 0; a < 1; a++) body]; | |

<<< | |

var list = [ | |

for (LongGenericTypeName<TypeArg, | |

AnotherTypeArgument> a = 0; | |

a < 1; | |

a++) | |

body | |

]; | |

>>> split in for initializer | |

var list = [for (a = initializerExpression + thatDoesNotFit; a < 1; a++) body]; | |

<<< | |

var list = [ | |

for (a = initializerExpression + | |

thatDoesNotFit; | |

a < 1; | |

a++) | |

body | |

]; | |

>>> split in for condition | |

var list = [for (a = b; conditionExpression + thatDoesNotFit; a++) body]; | |

<<< | |

var list = [ | |

for (a = b; | |

conditionExpression + | |

thatDoesNotFit; | |

a++) | |

body | |

]; | |

>>> split in for increment | |

var list = [for (a = b; a < 1; incrementExpression + thatDoesNotFit) body]; | |

<<< | |

var list = [ | |

for (a = b; | |

a < 1; | |

incrementExpression + | |

thatDoesNotFit) | |

body | |

]; |