A parser library (JSONC, YAML, TOML) should optionally let you parse comments — what you do with them is your prerogative.
Yes, your job is to parse
No, throw comments away
It's complicated
Poll ended at .
@fasterthanlime Full format preserving on edits is non-trivial and should generally handled separately from other parsing.
If you are working with a serde-like API, then it is very complicated to carry forward all formatting. This is especially true for formats with more flexible styling like yaml and toml. For example in toml, you have 3 different ways to define tables and sort order is a cross-table concern.
Whether you do serde-like or work with a Value that has the logical structure, there is a major performance impact to carry forward formatting. In a serde-like API, it is also quite invasive on your types.