Repository navigation
feat(mapper): show the file's comment and statement in the hover - #17
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues. Two rough edges are worth a look, inline.
Reviewed changes
This review covers the whole PR: three commits that add JSDoc to the module the content mapper writes, so a hover shows the .sql file's leading comment and its statement.
src/doc-comment.ts: newleadingComment/statementAfter/docComment. They read the leading comments the way each dialect does, and they escape*/and code fences.src/mapper.ts:query,sqlandraw(both the exports and the properties of the& { … }intersection, which is now multi-line) carry doc comments. The no-project path and the failed-analysis path get them too.src/index.ts:Query.sql/Query.rawdrop their own JSDoc, because the intersection hover would otherwise run it together with the module's doc.site/scripts/capture-types.ts+site/lib/sql-modules.json: the docs-site capture mirrors the mapper, and the modules were captured again.- Tests: a
doc-commentunit suite, a realtsc --lsphover check, and updatedcompileddeclaration assertions.tests/doc-comment.test.tspasses locally on Node 24. The LSP tests were not run here because dependencies weren't installed.
claude-opus-5-5 | 𝕏
colinhacks
force-pushed
the
statement-jsdoc
branch
from
October 22, 2026 18:28
ba6adac to
70e02dd
Compare
Contributor
There was a problem hiding this comment.
✅ No new issues found. Both earlier threads are resolved.
Reviewed changes
This review covers the one commit since the last Pullfrog review (3755f40 → ba6adac).
- Fixed
summary()insite/scripts/capture-types.ts: it now matchesdeclare const query: Query<…> & {at the end of its line, and the dialect strip anchors on"<dialect>"$. I checked this in Node against a multi-line declaration with nested generics. The capture log prints the one-line params/row/cardinality summary again. - Added an
@-line hover check totests/definition.test.ts: a SQLiteadd_post.sqlwhose@title/@bodylines start with@. The test asserts that the import's hover ends with the wholesqlblock, which guards the TypeScript 7.1 behavior. I didn't run the LSP test here becausenode_modulesisn't installed.
claude-opus-5-5 | 𝕏
colinhacks
force-pushed
the
statement-jsdoc
branch
from
October 22, 2026 19:17
70e02dd to
c7eaac0
Compare
colinhacks
force-pushed
the
statement-jsdoc
branch
from
October 22, 2026 19:33
c7eaac0 to
550f7f7
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.

A comment written at the top of a
.sqlfile now shows when you hover over the import. The module the content mapper writes givesquery(the default export),sqlandrawdoc comments. Each holds the file's leading comment as prose, then the statement in a```sqlblock:query): the statement as written.sql(the export and the property ofquery): the statement as Reylo sends it, with$1on Postgres and?/CAST(? AS …)on MySQL and SQLite.raw: the statement as written.Before / after
get_user.sqlon Postgres:Before, the hover over
getUsershowed only the type:(alias) const query: Query<{ id: number }, { … }, "maybeOne", "postgres"> & { readonly sql: typeof sql; readonly raw: typeof raw }. After, the type is followed by:The hover over
getUser.sql((property) sql: "-- The signed-in user's profile.\n…where id = $1\n") now carries:Details
src/doc-comment.ts): the--lines and/* … */blocks before the first token, with the markers stripped and the lines kept. A blank line starts a new paragraph. Comments are read the way each dialect reads them:#starts a comment,--starts one only when a space follows, and/*!//*+are code, not comments.sqlis plainstring, so that doc carries only the prose and the note.Query's ownsqlandrawlose their doc comments. TypeScript showed that generic text first and ran it into the module's doc in the same paragraph. The generic sentence now closes the module'ssqlandrawdocs instead.site/scripts/capture-types.tswrites the same doc comments andsite/lib/sql-modules.jsonwas captured again. With the comments stripped, the result is identical tomain's. The Editors section mentions the hover.Verified
tests/definition.test.tshovers over the import and over.sqlin the realtsc --lspand checks the prose and both statements.tests/doc-comment.test.tsunit-tests the comment reading and the escaping.tests/compiled.test.tschecks the declaration text on SQLite, Postgres and MySQL.typecheck,loader-tests(191 passed, 0 skipped),packageandsiteall pass.