Skip to content

Apply indentation before emitting comments on new lines#1426

Open
alexprabhat99 wants to merge 2 commits intojbeder:masterfrom
alexprabhat99:master
Open

Apply indentation before emitting comments on new lines#1426
alexprabhat99 wants to merge 2 commits intojbeder:masterfrom
alexprabhat99:master

Conversation

@alexprabhat99
Copy link
Copy Markdown

Fixes: #1392

@alexprabhat99
Copy link
Copy Markdown
Author

@SGSSGene I have fixed for failing tests and formatting.

@SGSSGene
Copy link
Copy Markdown
Collaborator

@alexprabhat99 thank you for this contribution.

@jbeder this is a behavior change, without any formal specification from yaml-specs. What are your thoughts on this?

@jbeder
Copy link
Copy Markdown
Owner

jbeder commented Mar 31, 2026

I think this is fine, it's a pure ergonomic thing and the spec doesn't specify what to do here.

I'd make sure it's well tested, though.

@SGSSGene
Copy link
Copy Markdown
Collaborator

SGSSGene commented Apr 1, 2026

@alexprabhat99
This PR looks good, but I think we should cover it with some more unit test.

like double nested comment

map1:
  map2:
    # nested comment
    foo: bar
map1:
  map2:
    foo: bar
    # nested comment at the end
map1:
  map2:
    foo: bar 
  # nested comment outside of map2

since you also correctly specified it in your code, I would check that FlowBlock isn't being influenced. (I am not even sure what to expect, can we even comment inside a FlowBlock?)

some_map: { foo: bar
  # comment
  key2: value2 }
  

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.

Comments inside maps aren't indented

3 participants