redhat-developer / redhat-developer/vscode-yaml
Formatter should not squash multiline string values
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'm attempting to embed a 50+ line INI file in a ConfigMap as a string. Whenever I save the file that section loses all of its formatting and it gets squashed into a single line sprinkled with literal \n and "magic line" comment blocks. This makes the embedded INI file unreadable for editing the configuration values so I have to go in and manually find-replace the formatting back how it was and re-indent the block.
Expected Behavior
Format-on-save should not mangle multiline strings. Newlines exist for a reason.
Current Behavior
Format-on-save mangles my strings.
Steps to Reproduce
- Create the following YAML file in VSCode:
apiVersion: v1
kind: ConfigMap
metadata:
name: foo
namespace: bar
data:
baz.ini: |+
"[section1]
a = b
x = y
[section2]
foo=bar"
- Save the file.
Environment
- Windows
- Mac
- Linux
- other (please specify)
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
Reproduce the issue in VS Code using the YAML ConfigMap example and format-on-save. Start by tracing the YAML formatter entry point responsible for multiline scalar strings; done means saving the file preserves the multiline value and does not insert literal \n text or comment blocks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100