Open uxder opened 4 years ago
Right now we don't have the ability to do that since the yaml parser (pyyaml) completely destroys the comments, we don't even have a way to find out what they were.
I did find out that there is one yaml parser that does preserve the comments (https://pypi.org/project/ruamel.yaml/) So we might look at it to see if it would be a valid replacement, at least for changing the yaml files. But we would also need to some crazy trickery to make sure that the comments stay with the correct data.
That project is active, so if it works it might be a nice replacement for just reading/writing the files for the purposes of the editor. :)
On Wed, Jun 10, 2020 at 8:33 PM Randy Merrill notifications@github.com wrote:
Right now we don't have the ability to do that since the yaml parser (pyyaml) completely destroys the comments, we don't even have a way to find out what they were.
I did find out that there is one yaml parser that does preserve the comments (https://pypi.org/project/ruamel.yaml/) So we might look at it to see if it would be a valid replacement, at least for changing the yaml files. But we would also need to some crazy trickery to make sure that the comments stay with the correct data.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/grow/grow-ext-editor/issues/81#issuecomment-642385195, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE527PQNG7UAAT3QAF3FVLRWBGARANCNFSM4N26CUHA .
I think saving is stripping out comments.
For example:
turns into:
Ideally, the editor would retain these comments as they are useful for developer comments.