Skip to content

[api] Add missing checker methods#4424

Open
andrewbranch wants to merge 3 commits into
microsoft:mainfrom
andrewbranch:api-checker-methods
Open

[api] Add missing checker methods#4424
andrewbranch wants to merge 3 commits into
microsoft:mainfrom
andrewbranch:api-checker-methods

Conversation

@andrewbranch

Copy link
Copy Markdown
Member

Closes #3610

The one bit of new implementation code is a port of some JSDoc functions from Strada. They weren't originally ported because internally, they were used for creating SymbolDisplayPart[] for hover; instead, similar methods were created for rendering markdown. I didn't want to reintroduce SymbolDisplayPart, but I thought returning the tags in structured form would still be useful, so where Strada returned an array of the following for Symbol.getJSDocTags():

interface JSDocTagInfo {
  name: string;
  text?: SymbolDisplayPart[];
}

Corsa returns an array of:

interface JSDocTagInfo {
  name: string;
  text?: string;
}

Copilot AI review requested due to automatic review settings June 23, 2026 23:15

Copilot AI 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.

Pull request overview

This PR extends the native-preview IPC API surface to cover additional TypeChecker-like methods and Symbol documentation helpers needed by transpiler consumers (per #3610), including a new JSDoc tag representation that returns plain strings instead of SymbolDisplayPart[].

Changes:

  • Added new API endpoints and client wrappers for checker methods like isArrayType, getBaseConstraintOfType, getPropertyOfType, getConstantValue, getSignatureFromDeclaration, getExportSpecifierLocalTargetSymbol, getAliasedSymbol, and getExportsOfModule.
  • Introduced Symbol.getDocumentationComment(checker) and Symbol.getJsDocTags(checker) backed by new language-service helpers that render docs/tags as plain text.
  • Added sync + async native-preview tests covering the new methods and behaviors.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/ls/jsdoc.go New LS helpers to extract documentation comment text and structured JSDoc tags as plain strings.
internal/checker/exports.go Exposes Checker.IsArrayType wrapper to support the new API endpoint.
internal/api/session.go Adds request dispatch + handlers for the newly exposed checker/symbol methods (including JSDoc endpoints).
internal/api/proto.go Adds new method constants and request/response parameter types (incl. JSDocTagInfo).
_packages/native-preview/test/sync/api.test.ts Adds sync API coverage for the new checker methods and symbol JSDoc/documentation behavior.
_packages/native-preview/test/async/api.test.ts Adds async API coverage mirroring the sync tests for the same new methods.
_packages/native-preview/src/api/sync/types.ts Adds JSDocTagInfo type for the sync client surface.
_packages/native-preview/src/api/sync/api.ts Adds sync client wrappers for new checker endpoints + symbol helpers.
_packages/native-preview/src/api/async/types.ts Adds JSDocTagInfo type for the async client surface.
_packages/native-preview/src/api/async/api.ts Adds async client wrappers for new checker endpoints + symbol helpers.

Comment thread internal/ls/jsdoc.go
Comment thread internal/ls/jsdoc.go
Comment thread internal/api/session.go
Comment thread internal/ls/jsdoc.go
Comment on lines +13 to +14
// JSDocTagInfo mirrors Strada's `JSDocTagInfo`, but renders the tag's text as a
// plain string instead of `SymbolDisplayPart[]`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this equivalent to existing code but we just say plaintext like LSP? can that save code?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No; this still separates tag names from comments.

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.

API: additional Checker methods for transpiler consumers (follow-up to #3403)

4 participants