redhat-developer / redhat-developer/vscode-yaml
Squashes multi-line JSON elements into one line
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Describe the bug
Recently (noticed it today), when formatting JSON in a YAML document, it squashes the JSON subtree into one line.
Expected Behavior
If I remember correctly, it always left JSON subtrees alone, or even formatted them nicely.
Current Behavior
The JSON part becomes one line, even for very long elements, making them hard-to-read.
Steps to Reproduce
- Enter YAML with some JSON, e.g.
foo:
bar: {
"x1": "x2",
"y1": "y2"
}
- Trigger formatting (CTRL-ALT-F, or autoformat-on-save)
- it turns it into
foo:
bar: { "x1": "x2", "y1": "y2" }
Environment
- Windows (probably others, too)
- Mac
- Linux
- other (please specify)
(Note: I tried to disable most other extensions, and still have this effect. I asked a colleague, who could reproduce it.)
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 the issue in VS Code with the YAML sample and the documented formatting commands. Trace the YAML formatting entry point and identify the behavior affecting embedded JSON; done means multiline JSON remains readable rather than being collapsed into one line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100