redhat-developer / redhat-developer/vscode-yaml

Formatting Breaking Null Values and Changing Quotations

Open
#1,148 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

invalid needs-info
Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

Describe the bug

In the last couple of months, the YAML extension has been messing with my YAML files in an undesirable way.
It has decided to start changing all double quotes to single quotes and, in some files, it has been moving some null objects {} and [] onto the next line, which has broken my YAML files as can be seen in the screenshot.

I don't have any other formatter installed and am up-to-date with this extension and all others. yq is also up-to-date on v4.47.2.

Image

Expected Behavior

Formatting the document should not push YAML object values to the next line. They should be untouched.
Double quotes should be left alone.

Current Behavior

Some, not all, empty values are pushed to the next line, such as null, [] and {}.
I am also seeing that formatting the document changes quotes from double quotations to single quotations.

I have verified manually and using CoPilot that my VS Code settings aren't causing this, especially the quotation changes.

Steps to Reproduce

  1. redhat.vscode-yaml, 1.18.0
  2. yq v4.47.2

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the formatter behavior in VS Code using redhat.vscode-yaml 1.18.0 and yq v4.47.2 on Windows, comparing quote changes and empty values such as null, [] and {}. The issue is done when formatting no longer changes double quotes or moves these empty values onto new lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.