8000 fix(cli): keep column comments in reylo play's types by colinhacks · Pull Request #143 · colinhacks/reylo · GitHub
[go: up one dir, main page]

Skip to content

fix(cli): keep column comments in reylo play's types - #143

Merged
colinhacks merged 2 commits into
mainfrom
type-comments
Oct 29, 2026
Merged

colinhacks merged 2 commits into
mainfrom
type-comments

Conversation

@colinhacks
Copy link
Copy Markdown
Owner

A column with a COMMENT made every query that reads it show unknown in reylo play and the playground's API: the row type a statement's module declares carries the comment as a doc comment before its field, and the formatter that breaks types over lines could not read one.

The formatter now reads a doc comment as part of the field after it. Broken over lines, each comment stays on the lines before its field, as TypeScript reads it; on one line (no width), it is written inline.

  • src/type-format.ts: doc comments in the tokenizer, the tree and both printers
  • tests/type-format.test.ts: one-line and multi-line comments, nested in a union, and with no width

@vercel
vercel Bot commented Oct 29, 2026 •
Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reylo Ready Ready Preview Oct 29, 2026 7:27pm UTC

Request Review

Copilot AI balanced review requested due to automatic review settings October 29, 2026 19:22
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hi 8000 ding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues. One rough edge inline.

Reviewed changes

This review covers the fix that teaches src/type-format.ts to read the field doc comments src/module-types.ts writes, so playResult no longer catches a parse error and shows unknown.

  • Tokenizer and tree: a /** … */ is now one token, and each object member keeps it as doc with its lines re-indented to *.
  • Printers: flat writes the comment inline through oneLineDoc. At any finite width, print breaks an object that has a documented field and puts each comment on the lines before its field.
  • Tests: the new tests/type-format.test.ts covers a one-line comment with an escaped *\/, a multi-line comment, a comment nested in a union, Infinity width, and types without comments. These pass, and tsc --noEmit --runExternalCode is clean.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread src/type-format.ts Resolved
@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. The earlier finding is fixed.

Reviewed changes

This review covers the one commit pushed since the last Pullfrog review.

  • oneLineDoc blank lines: changed the regex to /(?:\n[ \t]*\*[ \t]*)+/g, which turns each run of comment line breaks into one space. A paragraph break written as a bare * no longer leaves a stray * in the Infinity-width output. This also holds when the blank line comes just before */.
  • Test: added a two-paragraph comment to the no-width test, which expects /** para one para two */. All three tests in tests/type-format.test.ts pass.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@colinhacks
colinhacks merged commit a4311d1 into main Oct 29, 2026
7 checks passed
@colinhacks
colinhacks deleted the type-comments branch October 29, 2026 19:37
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.

2 participants

0