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

Fix/comment indents (and other comment-related issues) #664

Merged
merged 8 commits into from Jul 18, 2022

Conversation

krisrok
Copy link

@krisrok krisrok commented Jan 6, 2022

This fixes incorrect comment indents (#662), see the updated YamlCommentTests.

It also fixes incorrect YAML output when using newline-characters inside of the YamlMemberAttribute.Description (#663): Now the Emitter simply writes multiple comment lines.

Also adds some support for flow mapping: Comments get stripped when inside a flow block.

Notes about inline comments

Also, as it is pretty related: I've added some code regarding writing inline comments, but they are not really supported as of now anyway: There's no easy to use public API.
In my branch (https://github.com/krisrok/YamlDotNet/tree/feature/serialize-inline-comments) there is some preliminary support for inline comments but I could not come up with a complete solution: Inline comments on non-emtpy sequences still land on the next line.

cp added 8 commits January 5, 2022 17:26
Split code paths for inline and block comments
Write inline comments in one line
Set indent for block comments if we're about to enter a YAML block
Write block comments as multiple comment lines

Todo: Write tests for inline comments (no apparent way to emit them right now without a custom ObjectGraphVisitor)
@aaubry aaubry mentioned this pull request Apr 29, 2022
@EdwardCooke EdwardCooke merged commit eb4e558 into aaubry:master Jul 18, 2022
@aaubry
Copy link
Owner

aaubry commented Jul 23, 2022

This feature has been released in version 12.0.0.

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

Successfully merging this pull request may close these issues.

None yet

3 participants