Commit c01f73a
Keep
A model/scalar heritage clause (`is X` / `extends X`) wrapped the keyword and
the template reference in one `group(indent(...))`. Prettier measures that
group against the full flat width of the template argument list, so it broke
and pushed the keyword onto its own indented line even when the declaration
line was short:
model Picked
is PickProperties<
Sample,
...
>;
`printHeritageClause` now keeps the keyword inline when the base is a template
reference with multiple (breakable) arguments, letting the argument list
control the line break:
model Picked is PickProperties<
Sample,
...
>;
Single-argument and non-template bases keep breaking the keyword when the
declaration is too long.
Fixes the `is`-breaking part of #11009.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>is/extends inline for multi-argument template heritage1 parent ef4eacb commit c01f73a
3 files changed
Lines changed: 83 additions & 9 deletions
File tree
- .chronus/changes
- packages/compiler
- src/formatter/print
- test/formatter
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1043 | 1043 | | |
1044 | 1044 | | |
1045 | 1045 | | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1046 | 1071 | | |
1047 | 1072 | | |
1048 | 1073 | | |
1049 | 1074 | | |
1050 | 1075 | | |
1051 | 1076 | | |
1052 | 1077 | | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
| 1078 | + | |
| 1079 | + | |
1057 | 1080 | | |
1058 | 1081 | | |
1059 | 1082 | | |
| |||
1064 | 1087 | | |
1065 | 1088 | | |
1066 | 1089 | | |
1067 | | - | |
| 1090 | + | |
| 1091 | + | |
1068 | 1092 | | |
1069 | 1093 | | |
1070 | 1094 | | |
| |||
1240 | 1264 | | |
1241 | 1265 | | |
1242 | 1266 | | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
| 1267 | + | |
1246 | 1268 | | |
1247 | 1269 | | |
1248 | 1270 | | |
| |||
1253 | 1275 | | |
1254 | 1276 | | |
1255 | 1277 | | |
1256 | | - | |
| 1278 | + | |
1257 | 1279 | | |
1258 | 1280 | | |
1259 | 1281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
210 | 225 | | |
211 | 226 | | |
212 | 227 | | |
| |||
255 | 270 | | |
256 | 271 | | |
257 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
258 | 288 | | |
259 | 289 | | |
260 | 290 | | |
| |||
809 | 839 | | |
810 | 840 | | |
811 | 841 | | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
812 | 857 | | |
813 | 858 | | |
814 | 859 | | |
| |||
0 commit comments