google / google/yamlfmt

Comment on multiline map key is moved to value

Open
#301 2 comments 0 reactions 0 assignees View on GitHub
yaml_v3_problem
Dominant language
Go
Stars
1.8k
Forks
75
PR merge metrics
No merged PRs in 30d

Description

### Description

When formatting YAML that uses a **multiline block scalar as a map key**, comments attached to the key are not preserved.

---

### Reproduction

**Input:**

```yaml
? | # comment
multi
line
key
: value
```

**After `yamlfmt`:**

```yaml
? |
multi
line
key
: value # comment
```

The comment originally associated with the **multiline key (`? |`)** is moved to the value line.

---

### Expected behavior

The comment should remain attached to the multiline key, or the formatter should report that this construct is unsupported instead of silently moving the comment.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.