Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline trailing comments fail to round trip #47

Open
TristanCacqueray opened this issue Aug 1, 2020 · 2 comments
Open

Inline trailing comments fail to round trip #47

TristanCacqueray opened this issue Aug 1, 2020 · 2 comments

Comments

@TristanCacqueray
Copy link
Contributor

It seems like the comment event is missing some information to indicate if it is inline or standalone:

key: "value" # a comment

Results in (after passing through YE.writeEvents YT.UTF8 . map eEvent . rights . YE.parseEvents

key: "value"
# a comment

The events are:

MappingStart Nothing Nothing Block
Scalar Nothing Nothing Plain "key"
Scalar Nothing Nothing DoubleQuoted "value"
Comment " a comment"
MappingEnd

Would it be possible to add an attribute to the Comment event to preserve its line position?

@vijayphoenix
Copy link
Collaborator

Yes, some comment position related information is not preserved in a round trip.
See
https://hackage.haskell.org/package/HsYAML-0.2.1.0/docs/Data-YAML-Event.html#g:4
for more details.

@TristanCacqueray
Copy link
Contributor Author

Thank you for the reference. Isn't this something that could be improved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants