Skip to content

Keep indent indicator on empty root block scalar + comment - #721

Open
dyk1454683243-sudo wants to merge 1 commit into
eemeli:mainfrom
dyk1454683243-sudo:cursor/empty-root-block-scalar-comment-687-c190
Open

dyk1454683243-sudo wants to merge 1 commit into
eemeli:mainfrom
dyk1454683243-sudo:cursor/empty-root-block-scalar-comment-687-c190

Conversation

@dyk1454683243-sudo

Copy link
Copy Markdown

Issue

Fixes #687

LLM Use

An assistant helped apply the one-line header change and add the regression test. The wording here is mine. No generated comments in the code.

Description

toString() wrote an empty root | / > without an indent indicator, so a following document comment parsed as the scalar.

When forceBlockIndent is set, emit |2 / >2 so the comment stays a comment. Nested empty scalars already round-trip; this only covers the root case.

#697 tried a wider version of this and was closed by the author after review.

Empty | or > at the document root dropped the indent indicator, so a
following document comment was parsed back as scalar content. Emit |2
or >2 when forceBlockIndent is set.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@eemeli

eemeli commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Please quote to me here the last sentence of the contributing guide, which I trust you've read?

This branch has not been deployed

No deployments
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.

toString() incorrectly converts comment to string

3 participants