Open abbudao opened 9 months ago
yea, its definitely related to the toml parsing library I'm using. I'm open to changing it if there's a better one that you know of.
To remain all possible comments is really a hard work, and finally I'm coding a full support DOM-like thing to support unlimited use case, which already cost me weeks, a bit crazy fight.
Just wonder, maybe I got complicated thinking, is there any serialize tool in the world can remain full comment, for example in rust environment, even for other format like yaml or json5? Maybe I can be inspired, thank you!
I am not an expert in this field but preserving comments in Rust tooling is not uncommon. One example is cargo-edit which uses toml_edit under the hood to achieve that. AFAIK only order on dotted keys is not preserved. Sorry, but I'm not familiar with the internals to give you some insights firsthand.
@LongTengDao Thanks a lot, will you also allow for configuring the quotes used when stringifying? That would help reduce diffs
For example right now when implementing a versioning tool for this library I get a large diff because of the comment lost (as already discussed) and also the quotes being different post-serialization:
(The only genuine diff here should be the two version fields)
The quote changes are really deal breaker.
I have created a #59 PR. It should solve the problem
Hey @Cammisuli, how is it going? I just found out that the generator for new libraries is removing all comments on
Cargo.toml
. This is a bit bothersome because I find it very useful when running a monorepo to explain some dependencies and group them, for instance:This has been extremely helpful for new Rust developers who still need to learn the ecosystem.
To reproduce, paste the above dependencies on root
Cargo.toml
with comments and run a generator:yarn nx g @monodon/rust:lib my-lib
I need to dig more, but it's probably related to https://github.com/LongTengDao/j-toml/issues/19 ?