[Bug] Preserve comments and styling in YAML configuration
See original GitHub issueWhenever I update Yarn 2 or I want to test a branch with yarn set version from sources
it changes the yarnrc.yml
.
The order of the fields changes and the commented lines disappear, is it possible to keep the file as close as possible to the state in which the user left it?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Preserve comments and flow style when programmatically ...
yaml works by returning an OrderedDict of custom subclasses of the builtin types (to maintain file structure and to store comments), and provides...
Read more >YAML manipulation library that keeps comments and styling
We wanted to update some values in YAML files without loosing the formatting and comments. I wrote the YAWN YAML library to solve...
Read more >How can I keep comments of a yaml file when modify its ...
Yes, it is possible to prevent comments from being lost. The object returned from self.yaml.load() in your Config.__init__() method is not a ...
Read more >Editing YAML files spacing bug – IDEs Support (IntelliJ Platform)
When commenting a line in YAML file and un-commenting it indent order is not maintained. Mostly the one space is removed when un-commenting...
Read more >YAML Style Guide | Home Assistant Developer Docs
Adding comments to blocks of YAML can really help the reader understand the example better. The indentation level of the comment must match...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@paul-soporan I just came to search the issues after Yarn deleted my comments from
.yarnrc.yml
file (which made a bit angry to be honest 😄; I hate when tools silently drop my data) so it’s great to see your thoughtful comment above.I’ll just say a few things:
.yarnrc.yml
is unpleasant. In fact, we usually run a command likeyarn set version
, then copy the relevant line, revert the whole file and re-add manually. Doesn’t feel right.@lensbart
The road i tried didn’t give what i hoped for.
bundle size is okay, but too slow in my tests
https://github.com/yarnpkg/berry/pull/4135#discussion_r810542028
Another idea welcome