-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Blank Line Comments skipped #498
Comments
@DeltaOrion thank you for reporting this. I'll assign someone to take care of it soon. |
@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role Please, make sure there is at least one available contributor with the required role and the project can afford to pay them. |
@DeltaOrion I'm no sure this is a bug. If I remember well, this was intended behaviour: blank lines and blank comment lines are ignored. Let's leave it open for a while and see if someone else has this issue or other opinion :D |
https://yaml.org/spec/1.2.2/#comments According to the YAML spec comments aren't associated to a particular node. But for having any kind of comment support it is only natural that it is attached to a node because comments are almost always there to describe the purpose of the node. Thus, As to whether this is intended behavior would really depend on your requirements. It seems more natural to me that all of the consecutive comment lines above the node are counted as comments whether or not the comment line has content or not but at the end of the day it is up to your teams requirements. But blank lines aren't really ignored because When reading
It produces the output But when reading
It produces the output `` |
@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role Please, make sure there is at least one available contributor with the required role and the project can afford to pay them. |
1 similar comment
@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role Please, make sure there is at least one available contributor with the required role and the project can afford to pay them. |
I hit this as well. If the comments are like this: # Comment line 1
# Comment line 2
#
# Comment line 3
field: value And you do a simple "round-trip" where you ingest this YAML and then print it, what you get back is: # Comment line 3
field: value It doesn't just "ignore blank lines". It loses entire chunks of the comment. |
@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role Please, make sure there is at least one available contributor with the required role and the project can afford to pay them. |
Version: 6.0.1
Issue: If a key has a comment with no content inside of the comment then that line and any above lines will not be counted as apart of comments for that node
When reading the following yaml file
When reading the comments from the node
key
usingYamlNode#comment()#value()
It only returns[comment line 4]
. I believe it should return all 4 comment lines that being,[comment line 1, comment line 2, , comment line 4]
However, when reading this yaml file
Reading the comments from the node
key
usingYamlNode#comment#value()
returns all 4 comment lines correctly that being[comment line 1, comment line 2, abc, comment line 4]
The text was updated successfully, but these errors were encountered: