redhat-developer / redhat-developer/vscode-yaml
Peculiar behavior around anchors and comments
Open
Nobody has claimed this yet.
formatter
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Describe the bug
Expected Behavior
I have this yaml:
when: &shall
# we three meet again; in lightning, thunder and in
rain:
Current Behavior
It moves the comment to the anchor:
when: &shall # we three meet again; in lightning, thunder and in
rain:
Expected Behavior 2
It's even worse if the comment is long:
when: &shall
# we three meet again; in lightning, thunder and in lightning, thunder and
rain:
Current Behavior 2
It moves the anchor down to the next line
when:
&shall # we three meet again; in lightning, thunder and in lightning, thunder and
rain:
Environment
- Windows
- Mac
- Linux
- other (please specify)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing issue #459 in the VS Code YAML support extension using the YAML examples in the report, focusing on anchors and preceding comments. Trace the formatting or parsing entry point responsible for the output; done means comments remain in their original position and anchors are not moved when comment length changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100