redhat-developer / redhat-developer/vscode-yaml

Code formatting issue with line length

Open
#938 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

@msivasubramaniaan, I found the cause of bug #855. It's not related to a schema but to the number of characters. This code doesn't format correctly if any of the first 3 lines have an extra character.

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
    bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:
        ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc:
            error: true

Expected Behavior

Ext should format code correctly, regardless of line length.

Current Behavior

Adding a character to the 3rd line causes this incorrect format.

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
    bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:
        ? cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccX
        : error: true

Steps to Reproduce

  1. Open VSCode and use the provided code
  2. Add a character to the first 3 lines
  3. Save or format the code.

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
vscode: v1.78.2
yaml ext: v1.13.0

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

Start by reproducing the formatting problem in VSCode with the YAML extension using the sample configuration and the stated version information. Trace the YAML formatter entry point involved in line-length handling; done means the sample formats correctly after adding characters to any of the first three lines, without producing the incorrect mapping-key layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.