vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

Formatting Breaking Null Values and Changing Quotations

Open joshwright10 opened this issue 4 months ago • 1 comments

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

  • [x] Windows
  • [ ] Mac
  • [ ] Linux
  • [ ] other (please specify)

joshwright10 avatar Sep 24 '25 13:09 joshwright10

~~I can't replicate the behaviour of {} being put on a new line, but I can replicate the double quotes being turned into single quotes, even though the formatter is configured to use double quotes.~~

I can't replicate the behaviour of the formatter switching from double to single quotes either, unless I enable the setting that does that.

datho7561 avatar Dec 09 '25 16:12 datho7561