Commit b65f9c0
authored
Fix anchor on MappingStart in sequence entry losing prefix (#6732)
When a YAML anchor appeared on a MappingStart event inside a sequence
(e.g. `- &b\n k2: v2`), the dash prefix was incorrectly truncated
from the mapping's format string. This caused the SequenceBuilder to
create an entry with isDash=false, producing `- k: v &b\n k2: v2`
instead of preserving the original `- k: v\n- &b\n k2: v2`.
The fix removes the dash-index truncation of `fmt` in the MappingStart
anchor handling. The `fmt` is kept as-is so the SequenceBuilder can
properly split it and preserve the dash indicator.1 parent 1c396f6 commit b65f9c0
3 files changed
Lines changed: 24 additions & 7 deletions
File tree
- rewrite-javascript/rewrite/test/yaml
- rewrite-yaml/src
- main/java/org/openrewrite/yaml
- test/java/org/openrewrite/yaml
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
488 | 499 | | |
489 | 500 | | |
490 | 501 | | |
| |||
Lines changed: 0 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | 249 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | 250 | | |
258 | 251 | | |
259 | 252 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
761 | 761 | | |
762 | 762 | | |
763 | 763 | | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
764 | 777 | | |
765 | 778 | | |
766 | 779 | | |
| |||
0 commit comments