question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Preserve comments and styling in YAML configuration

See original GitHub issue

Whenever 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:open
  • Created 3 years ago
  • Reactions:7
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
borekbcommented, Sep 8, 2020

@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:

  • Reordering .yarnrc.yml is unpleasant. In fact, we usually run a command like yarn set version, then copy the relevant line, revert the whole file and re-add manually. Doesn’t feel right.
  • Data loss is plan unacceptable, IMO.
  • Bundle size wouldn’t be a problem if the binary wasn’t committed to a Git repo – I guess we’re waiting for #969 or pmm so generally yeah, you probably need to worry about bundle size and make difficult tradeoffs.
0reactions
belgattitudecommented, Mar 12, 2022

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found