Skip to content

Conversation

@fisker
Copy link
Member

@fisker fisker commented Dec 5, 2025

No description provided.

@fisker fisker force-pushed the comment-after-end-mark branch from c2144a3 to de11e6d Compare December 5, 2025 09:15
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Size Change: -443 B (-0.59%)

Total Size: 74.3 kB

Filename Size Change
./dist/transforms/document-body.mjs 3.65 kB +11 B (+0.3%)
./dist/transforms/document-head.mjs 2.48 kB +13 B (+0.53%)
./dist/transforms/documents.mjs 2.33 kB -467 B (-16.68%) 👏
ℹ️ View Unchanged
Filename Size
./dist/attach.mjs 5.17 kB
./dist/cst.d.mts 414 B
./dist/cst.mjs 732 B
./dist/factories 4.1 kB
./dist/factories/alias.mjs 234 B
./dist/factories/anchor.mjs 167 B
./dist/factories/block-folded.mjs 179 B
./dist/factories/block-literal.mjs 183 B
./dist/factories/block-value.mjs 308 B
./dist/factories/content.mjs 178 B
./dist/factories/directive.mjs 251 B
./dist/factories/document-body.mjs 252 B
./dist/factories/document-head.mjs 262 B
./dist/factories/document.mjs 317 B
./dist/factories/flow-collection.mjs 296 B
./dist/factories/flow-mapping-item.mjs 250 B
./dist/factories/flow-mapping.mjs 298 B
./dist/factories/flow-sequence-item.mjs 225 B
./dist/factories/flow-sequence.mjs 302 B
./dist/factories/mapping-item.mjs 233 B
./dist/factories/mapping-key.mjs 260 B
./dist/factories/mapping-value.mjs 291 B
./dist/factories/mapping.mjs 223 B
./dist/factories/plain.mjs 234 B
./dist/factories/position.mjs 249 B
./dist/factories/quote-double.mjs 179 B
./dist/factories/quote-single.mjs 179 B
./dist/factories/quote-value.mjs 255 B
./dist/factories/root.mjs 187 B
./dist/factories/sequence-item.mjs 291 B
./dist/factories/sequence.mjs 246 B
./dist/factories/tag.mjs 155 B
./dist/index.d.mts 1.25 kB
./dist/index.mjs 131 B
./dist/parse.d.mts 174 B
./dist/parse.mjs 1.46 kB
./dist/transforms 4.1 kB
./dist/transforms/alias.mjs 578 B
./dist/transforms/block-folded.mjs 547 B
./dist/transforms/block-literal.mjs 556 B
./dist/transforms/block-value.mjs 1.5 kB
./dist/transforms/comment.mjs 286 B
./dist/transforms/content.mjs 1.43 kB
./dist/transforms/context.d.mts 883 B
./dist/transforms/context.mjs 1.08 kB
./dist/transforms/directive.mjs 426 B
./dist/transforms/document.mjs 919 B
./dist/transforms/flow-map.mjs 1.84 kB
./dist/transforms/flow-seq.mjs 3.5 kB
./dist/transforms/map.mjs 1.31 kB
./dist/transforms/pair.mjs 3.99 kB
./dist/transforms/plain.mjs 1.04 kB
./dist/transforms/quote-double.mjs 563 B
./dist/transforms/quote-single.mjs 563 B
./dist/transforms/quote-value.mjs 618 B
./dist/transforms/seq.mjs 2.82 kB
./dist/transforms/transform.d.mts 795 B
./dist/transforms/transform.mjs 1.81 kB
./dist/types.d.mts 5.13 kB
./dist/utils 4.1 kB
./dist/utils/create-updater.mjs 261 B
./dist/utils/define-parents.mjs 973 B
./dist/utils/extract-comments.mjs 340 B
./dist/utils/find-char-index.mjs 215 B
./dist/utils/find-last-char-index.mjs 255 B
./dist/utils/get-last.mjs 126 B
./dist/utils/get-point-text.mjs 187 B
./dist/utils/update-positions.mjs 2.26 kB
./dist/yaml-syntax-error.d.mts 390 B
./dist/yaml-syntax-error.mjs 368 B

compressed-size-action

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 5, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/[email protected]

commit: 33ee679

@fisker fisker force-pushed the comment-after-end-mark branch from de11e6d to b4a525b Compare December 5, 2025 09:17
@fisker fisker changed the title Don't add document for comments after ... Don't create document for comments after ... Dec 5, 2025
@fisker
Copy link
Member Author

fisker commented Dec 5, 2025

@ota-meshi I think it's reasonable to make this change.

YAML treats it like this too

image image

@fisker fisker marked this pull request as ready for review December 5, 2025 09:41
@fisker fisker force-pushed the comment-after-end-mark branch from 1d6b21f to 33ee679 Compare December 5, 2025 09:57
@ota-meshi
Copy link
Contributor

The new AST looks good to me.
However, I'm a bit worried about whether the new AST will properly preserve comments after Prettier formats them.
Will Prettier be able to process comments properly even if they're not attached to a document node?

@ota-meshi
Copy link
Contributor

Maybe I misunderstood.
Will it be preserved as an endComment? If so, I needn't have worried.

@fisker
Copy link
Member Author

fisker commented Dec 6, 2025

Will it be preserved as an endComment?

Yes, it will be endComment after ....

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.

3 participants