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

Comments of the first item of a multiple maps is associated to the map itself #311

Closed
nervo opened this issue Aug 10, 2022 · 1 comment · Fixed by #532
Closed

Comments of the first item of a multiple maps is associated to the map itself #311

nervo opened this issue Aug 10, 2022 · 1 comment · Fixed by #532
Labels
bug Something isn't working parser

Comments

@nervo
Copy link
Contributor

nervo commented Aug 10, 2022

In case of a map with multiple items, the first item comments are associated to the map node itself.
Single maps items, or other multiple maps items comments are not affected.

Here, in a single item map, foo node is a single ast.MappingValueNode and correctly get its comments:

map_single:
    # foo single comment
    foo: bar

In this multiple items maps, map node is a ast.MappingNode, and get the comments of its first item. This first item comments are therefore empty, whereas the second item comments are correctly set:

map_multiple:
    # foo multiple comment
    foo: bar
    # bar multiple comment
    bar: baz

See this playground: https://go.dev/play/p/HpPFOrJkVwF

(this could be more or less related to #310)

@goccy goccy added bug Something isn't working parser labels Nov 12, 2024
@goccy
Copy link
Owner

goccy commented Nov 12, 2024

Thank you for your reporting ! I'll fix this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants