Repository navigation
feat(printer): implement JSDoc node emission - #65430
Open
el-j (el-j) wants to merge 3 commits into
Open
el-j (el-j) wants to merge 3 commits into
el-j (el-j) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 10, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The JSDoc emitter drops qualified-name components and documentation content, while regression tests bypass the new emitter and leave key behavior unverified.
4 open issues
What changed in this PR
Implements JSDoc AST emission in the native TypeScript printer, replacing the panic reported in #65429. The change stays focused on printing and leaves synthetic-comment API support to #64500.
Changes:
- Adds formatting for JSDoc comments, tags, links, names, and related type nodes.
- Adds precedence handling for additional JSDoc node kinds.
- Adds printer tests for JSDoc output and whitespace preservation.
| File | Description |
|---|---|
tsc/internal/printer/printer.go |
Implements JSDoc node emission and formatting helpers. |
tsc/internal/printer/printer_test.go |
Adds direct-node and source-comment emission tests. |
tsc/internal/ast/precedence.go |
Defines precedence for additional JSDoc node kinds. |
Review effort: Balanced
- keep continuation lines when a tag comment starts with a newline - keep documented @property/@PARAM children as separate tag lines - print the terminal identifier of qualified typedef/callback names - omit the stray space after {@link name} without text - test JSDoc emission by printing JSDoc nodes directly Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
|
This fixes a crash in the printer ( |
This branch has not been deployed
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.

Fixes #65429
Analysis
Printer.emitJSDocNodeintsc/internal/printer/printer.gois a stub (panic("not implemented")), so any JSDoc AST node that reaches the printer, for example one built withNodeFactory.NewJSDoc, crashes it:Fix
Implements JSDoc emission in the printer: the comment text and the tags (
@param,@returns,@type,@typedef, etc.), single-line vs multi-line layout, and the related type expression and name nodes. It also adds a small supporting change intsc/internal/ast/precedence.go. Tests are inprinter_test.go.Review feedback is addressed in 7ae20f1: documented
@property/@paramchildren are kept as separate tag lines, qualified@typedef/@callbacknames keep their last component, tag comments starting with a newline keep their content, and tests now print JSDoc nodes directly.This is intentionally scoped to the printer only. An earlier attempt (#65058, closed) also added synthetic-comment API plumbing. That overlaps with open PR #64500, so it is left out here.
Related (not fixed here): #64429 / #64500 (API support for synthetic comments and emit flags), #17146 (transforming and emitting JSDoc comments).
Copilot Checklist
I successfully ran the applicable command at the end of my session, and it completed without error: