-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Right now, the only way to edit whitespace in the round-trip model is to directly edit the context attribute containing the whitespace/comment context.
This is potentially error-prone, as there is no validation that the results, when serialized, will produce a valid JSON5 text. The model also currently simply holds these as Strings of the whitespace and comments concattenated together, so there is also no distinction between productions that have contextual comments and productions that merely have contextual whitespace.
The only existing prior art I know of for this from personal use is from the Python projects ruamel.yaml which provides some useful methods for editing comments. e.g. set_start_comment, yaml_add_eol_comment, set_comment_before_after_key. This may be a reasonable model for providing similar methods in this crate.