redhat-developer / redhat-developer/vscode-yaml
Property names/keys with more than 80 symbols get prefixed with question mark ?, and colon : gets wrapped onto the next line
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Describe the bug
I have a YAML file like this:
services:
Drupal\some\long\service\name\name\name\name\name\name\name\name\na\length_80:
tags:
- name: event_subscriber
Drupal\some\long\service\name\name\name\name\name\name\name\name\nam\length_81:
tags:
- name: event_subscriber
And the formatter always changes it to the:
services:
Drupal\some\long\service\name\name\name\name\name\name\name\name\na\length_80:
tags:
- name: event_subscriber
? Drupal\some\long\service\name\name\name\name\name\name\name\name\nam\length_81
: tags:
- name: event_subscriber
So, names/keys with a length of more than 80 symbols get prefixed with the question mark ?, and the colon : gets wrapped onto the next line.
Expected Behavior
The formatter should keep the original formatting.
Current Behavior
See above.
Steps to Reproduce
- Create a YAML file with the content in the first code block.
- Format the file.
- See the wrong changes.
Environment
VS Code version: 1.81.1
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
Date: 2023-08-09T22:18:39.991Z
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 6.2.0-27-generic
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the formatter behavior in the vscode-yaml extension using the YAML example with 80- and 81-character keys. Trace the formatter entry point responsible for line wrapping and inspect how long mapping keys are emitted. Done means formatting preserves the key and colon on the same line without adding the ? prefix.
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
- 42/100