OLD | NEW |
(Empty) | |
| 1 40 columns | |
| 2 >>> many parameters |
| 3 method(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, |
| 4 tenth, eleventh, twelfth) { |
| 5 print('42'); |
| 6 } |
| 7 <<< |
| 8 method( |
| 9 first, |
| 10 second, |
| 11 third, |
| 12 fourth, |
| 13 fifth, |
| 14 sixth, |
| 15 seventh, |
| 16 eighth, |
| 17 ninth, |
| 18 tenth, |
| 19 eleventh, |
| 20 twelfth) { |
| 21 print('42'); |
| 22 } |
| 23 >>> parameters fit but ) does not |
| 24 method(int firstArgument, int argumentTo) { |
| 25 print('42'); |
| 26 } |
| 27 <<< |
| 28 method( |
| 29 int firstArgument, int argumentTo) { |
| 30 print('42'); |
| 31 } |
| 32 >>> parameters fit but } does not |
| 33 method(int firstArgument, int argument) { |
| 34 print('42'); |
| 35 } |
| 36 <<< |
| 37 method( |
| 38 int firstArgument, int argument) { |
| 39 print('42'); |
| 40 } |
| 41 >>> no split after "(" in lambda |
| 42 var meth = ( |
| 43 int firstArgument, int argumentTo) { |
| 44 print('42'); |
| 45 }; |
| 46 <<< |
| 47 var meth = (int firstArgument, |
| 48 int argumentTo) { |
| 49 print('42'); |
| 50 }; |
| 51 >>> keep mandatory and positional on same line |
| 52 foo(param, [foo, bar]) {} |
| 53 <<< |
| 54 foo(param, [foo, bar]) {} |
| 55 >>> keep mandatory and named on same line |
| 56 foo(param, {foo, bar}) {} |
| 57 <<< |
| 58 foo(param, {foo, bar}) {} |
| 59 >>> move just optional positional to second line even though all fit on second |
| 60 reallyLongMethod(parameter, [foo, bar]) {} |
| 61 <<< |
| 62 reallyLongMethod(parameter, |
| 63 [foo, bar]) {} |
| 64 >>> move just named to second line even though all fit on second |
| 65 reallyLongMethod(parameter, {foo, bar}) {} |
| 66 <<< |
| 67 reallyLongMethod(parameter, |
| 68 {foo, bar}) {} |
| 69 >>> avoid splitting in function type parameters |
| 70 bool doStuff(parameter1, void printFn(param1, param2)) {} |
| 71 <<< |
| 72 bool doStuff(parameter1, |
| 73 void printFn(param1, param2)) {} |
| 74 >>> |
| 75 doStuff(param1, void printFn(param1, param2)) {} |
| 76 <<< |
| 77 doStuff(param1, |
| 78 void printFn(param1, param2)) {} |
| 79 >>> allow splitting in function type parameters |
| 80 doStuff(callback(parameter1, parameter2, parameter3, parameter4)) {} |
| 81 <<< |
| 82 doStuff(callback(parameter1, parameter2, |
| 83 parameter3, parameter4)) {} |
| 84 >>> split optional onto one per line if they don't fit on one line |
| 85 doStuff([parameter1, parameter2, parameter3]) {} |
| 86 <<< |
| 87 doStuff( |
| 88 [parameter1, |
| 89 parameter2, |
| 90 parameter3]) {} |
| 91 >>> split on positional default value |
| 92 doStuff([parameter = veryLongDefaultValueThatSplits, another = |
| 93 veryLongDefaultValue, third = alsoQuiteLongDefaultValue]) {} |
| 94 <<< |
| 95 doStuff( |
| 96 [parameter = |
| 97 veryLongDefaultValueThatSplits, |
| 98 another = veryLongDefaultValue, |
| 99 third = |
| 100 alsoQuiteLongDefaultValue]) {} |
| 101 >>> split on named value |
| 102 doStuff({parameter: veryLongDefaultValueThatSplits, another: |
| 103 veryLongDefaultValue, third: alsoAQuiteLongDefaultValue}) {} |
| 104 <<< |
| 105 doStuff( |
| 106 {parameter: |
| 107 veryLongDefaultValueThatSplits, |
| 108 another: veryLongDefaultValue, |
| 109 third: |
| 110 alsoAQuiteLongDefaultValue}) {} |
OLD | NEW |