OLD | NEW |
(Empty) | |
| 1 40 columns | |
| 2 >>> many arguments |
| 3 method(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, |
| 4 tenth, eleventh, twelfth); |
| 5 <<< |
| 6 method( |
| 7 first, |
| 8 second, |
| 9 third, |
| 10 fourth, |
| 11 fifth, |
| 12 sixth, |
| 13 seventh, |
| 14 eighth, |
| 15 ninth, |
| 16 tenth, |
| 17 eleventh, |
| 18 twelfth); |
| 19 >>> wrap before first argument |
| 20 longFunctionIsLoooooooooooooong(argument, argument); |
| 21 <<< |
| 22 longFunctionIsLoooooooooooooong( |
| 23 argument, argument); |
| 24 >>> wrap with just one argument |
| 25 print('a very very long string literal'); |
| 26 <<<< |
| 27 print( |
| 28 'a very very long string literal'); |
| 29 >>> |
| 30 printNumbers(000000000000000000000, 111); |
| 31 <<< |
| 32 printNumbers( |
| 33 000000000000000000000, 111); |
| 34 >>> |
| 35 function(firstArg * second, third * fourthAndLongest); |
| 36 <<< |
| 37 function(firstArg * second, |
| 38 third * fourthAndLongest); |
| 39 >>> arguments, nested |
| 40 someFunctionOne(someArgument, |
| 41 someFunctionTwo(argument, argument, argument), |
| 42 someFunctionTwo(argument, argument, argument), |
| 43 someArgument, someArgument); |
| 44 <<< |
| 45 someFunctionOne( |
| 46 someArgument, |
| 47 someFunctionTwo( |
| 48 argument, argument, argument), |
| 49 someFunctionTwo( |
| 50 argument, argument, argument), |
| 51 someArgument, |
| 52 someArgument); |
| 53 >>> force all arguments to split if an argument splits |
| 54 foo(a, b, inner(veryLongArgument, veryLongArgument), c); |
| 55 <<< |
| 56 foo( |
| 57 a, |
| 58 b, |
| 59 inner(veryLongArgument, |
| 60 veryLongArgument), |
| 61 c); |
| 62 >>> do not force single-argument list to split if argument splits |
| 63 foo(inner(veryLongArgument, veryLongArgument)); |
| 64 <<< |
| 65 foo(inner(veryLongArgument, |
| 66 veryLongArgument)); |
| 67 >>> do not split empty argument list |
| 68 foo___________________________________(); |
| 69 <<< |
| 70 foo___________________________________(); |
| 71 >>> do split empty argument list if it contains a comment |
| 72 foo___________________________________(/* */); |
| 73 <<< |
| 74 foo___________________________________( |
| 75 /* */); |
| 76 >>> keep positional and named on first line |
| 77 foo(arg, arg, foo: 1, bar: 2); |
| 78 <<< |
| 79 foo(arg, arg, foo: 1, bar: 2); |
| 80 >>> move just named to second line even though all fit on second |
| 81 reallyLongMethod( |
| 82 argument, foo: first, bar: second); |
| 83 <<< |
| 84 reallyLongMethod(argument, |
| 85 foo: first, bar: second); |
| 86 >>> split named and keep positional on first |
| 87 reallyLongMethod(argument, argument, foo: first, bar: second, baz: third); |
| 88 <<< |
| 89 reallyLongMethod(argument, argument, |
| 90 foo: first, |
| 91 bar: second, |
| 92 baz: third); |
| 93 >>> only named arguments and move to second line |
| 94 reallyLongMethod(foo: first, bar: second, ba: third); |
| 95 <<< |
| 96 reallyLongMethod( |
| 97 foo: first, bar: second, ba: third); |
| 98 >>> only named arguments and split |
| 99 reallyLongMethod(foo: first, bar: second, baz: third); |
| 100 <<< |
| 101 reallyLongMethod( |
| 102 foo: first, |
| 103 bar: second, |
| 104 baz: third); |
| 105 >>> if split before first positional, split before first named too |
| 106 reallyLongMethodName( |
| 107 first, second, third, a: 1, b: 1); |
| 108 <<< |
| 109 reallyLongMethodName( |
| 110 first, second, third, |
| 111 a: 1, b: 1); |
| 112 >>> if split before other positional, split before first named too |
| 113 reallyLongMethodName(first, second, |
| 114 third, fourth, fif, s, a: 1, b: 1); |
| 115 <<< |
| 116 reallyLongMethodName(first, second, |
| 117 third, fourth, fif, s, |
| 118 a: 1, b: 1); |
| 119 >>> if positional args go one per line, named do too |
| 120 reallyLongMethod(first, second, third, fourth, fifth, sixth, seventh, eighth, a:
1, b: 2); |
| 121 <<< |
| 122 reallyLongMethod( |
| 123 first, |
| 124 second, |
| 125 third, |
| 126 fourth, |
| 127 fifth, |
| 128 sixth, |
| 129 seventh, |
| 130 eighth, |
| 131 a: 1, |
| 132 b: 2); |
| 133 >>> avoid splitting before single positional argument |
| 134 someLongReceiver.veryLongMethod(argument); |
| 135 <<< |
| 136 someLongReceiver |
| 137 .veryLongMethod(argument); |
| 138 >>> multiple nested collections |
| 139 method(function([veryLongElement, veryLongElement], [veryLongElement, veryLongEl
ement]), argument); |
| 140 <<< |
| 141 method( |
| 142 function([ |
| 143 veryLongElement, |
| 144 veryLongElement |
| 145 ], [ |
| 146 veryLongElement, |
| 147 veryLongElement |
| 148 ]), |
| 149 argument); |
| 150 >>> trailing collections are not indented |
| 151 function(argument, argument, argument, argument, |
| 152 [element, element, element, element], |
| 153 {'key': value, 'other key': value, 'third key': value}); |
| 154 <<< |
| 155 function(argument, argument, argument, |
| 156 argument, [ |
| 157 element, |
| 158 element, |
| 159 element, |
| 160 element |
| 161 ], { |
| 162 'key': value, |
| 163 'other key': value, |
| 164 'third key': value |
| 165 }); |
| 166 >>> all trailing collections |
| 167 function([element, element, element, element], {'key': value, 'other key': value
, 'third key': value}); |
| 168 <<< |
| 169 function([ |
| 170 element, |
| 171 element, |
| 172 element, |
| 173 element |
| 174 ], { |
| 175 'key': value, |
| 176 'other key': value, |
| 177 'third key': value |
| 178 }); |
| 179 >>> non-collection non-preceding argument forces all collections to indent |
| 180 function([element, element, element, element], argument, |
| 181 {'key': value, 'other key': value, 'third key': value}, () {;}); |
| 182 <<< |
| 183 function( |
| 184 [ |
| 185 element, |
| 186 element, |
| 187 element, |
| 188 element |
| 189 ], |
| 190 argument, |
| 191 { |
| 192 'key': value, |
| 193 'other key': value, |
| 194 'third key': value |
| 195 }, () { |
| 196 ; |
| 197 }); |
OLD | NEW |