feat(format/yaml): block scalar trailing comment lines - #11058
Merged
dyc3 merged 5 commits intoJul 29, 2026
Conversation
Contributor
✅ Organic activityNo automation signals detected in the analyzed events. This is an automated analysis by AgentScan |
|
dyc3
marked this pull request as draft
July 23, 2026 20:51
dyc3
force-pushed
the
dyc3/yaml-fmt-block-scalar-comments
branch
from
July 27, 2026 11:58
52c96b8 to
8cd0aca
Compare
dyc3
force-pushed
the
dyc3/yaml-fmt-block-scalar-comments
branch
from
July 28, 2026 20:19
8cd0aca to
18b4ce8
Compare
dyc3
marked this pull request as ready for review
July 28, 2026 22:40
ematipico
approved these changes
Jul 29, 2026
ematipico
left a comment
Member
There was a problem hiding this comment.
Comments here are like hell :D
A non-empty line indented less than the base ends a block scalar per
the spec, but the lexer includes such lines (trailing comments, in
practice) in the content token, and the formatter fell back to
verbatim. The content now ends at the first such line; the blank
lines the chomping dropped and the comment lines after them print
after the scalar, dedented to the document root:
strip: |-
# text
# comment
Whitespace-only lines at or below the base indentation now count as
empty for chomping. This removes the last verbatim fallback; the now
unused verbatim helper stays as dead code because the rules that
`just gen-formatter` generates for new syntax nodes call it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01472YxeN6U2t4LWfaqkieAv
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01472YxeN6U2t4LWfaqkieAv
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017JxH5Z1zv28qj1CcHABVee
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017JxH5Z1zv28qj1CcHABVee
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017JxH5Z1zv28qj1CcHABVee
dyc3
force-pushed
the
dyc3/yaml-fmt-block-scalar-comments
branch
from
July 29, 2026 12:38
18b4ce8 to
bfa9baa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
More comment handling in block scalars, and removes the last verbatim formatting call.
I'll let the clanker explain
A non-empty line indented less than the base ends a block scalar per
the spec, but the lexer includes such lines (trailing comments, in
practice) in the content token, and the formatter fell back to
verbatim. The content now ends at the first such line; the blank
lines the chomping dropped and the comment lines after them print after the scalar, dedented to the document root:
Whitespace-only lines at or below the base indentation now count as
empty for chomping. This removes the last verbatim fallback.
implemented by fable 5
Test Plan
updated snapshots
Docs