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

Formating removes vertical alignment of values

Open madpipeline opened this issue 3 years ago • 6 comments

Describe the bug

When formatting the whitespace used for vertical alignment of values is removed, even though the YAML specs allow and encourage it.

Currently there is no way to work around this issue except by disabling the formatter. Installing the Prettier extension keeps the alignment but does not enforce it (by default).

Expected Behavior

When formatting, values vertical alignment to be kept or added

tree:
    fruit:    "pear"
    name:     "peartree"
    location: "garden"

Current Behavior

Regardless of how they are vertically aligned, they the whitespace is stripped.

tree:
    fruit: "pear"
    name: "peartree"
    location: "garden"

Steps to Reproduce

  1. Write any YAML file and align the values vertically using spaces
  2. Format the file using this plugin's formatter
  3. Alignment is broken

Environment

  • [x] Linux

madpipeline avatar Feb 12 '22 00:02 madpipeline

Moving from atom to vscode. Really needed this especially for ansible playbook

Any update ?

wiryonolau avatar Jul 30 '22 02:07 wiryonolau

+1 on this. For yaml configuration files vertical alignment really makes a big difference in readability.

blerrgh avatar Feb 13 '23 03:02 blerrgh

Still no updates till this day

ouhzee avatar Nov 30 '23 05:11 ouhzee

It would be nice to be able to align the values as Intellij Idea do.

SimonG-Alza avatar Mar 19 '24 10:03 SimonG-Alza