redhat-developer / redhat-developer/vscode-yaml

Formating removes vertical alignment of values

Open
#695 7 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

  • Linux

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

No source file or test is named in the issue. Reproduce the behavior with the provided YAML example, then locate the plugin's formatter entry point and add coverage showing that vertical value alignment is preserved or added when formatting completes.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.