Conversation
Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/e0d51754-2f92-4709-9f6c-7789ab0dd905
Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/e0d51754-2f92-4709-9f6c-7789ab0dd905
Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/7d4dae2c-9f97-431a-ac50-a96977ea00a5
Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/0337a03b-8e52-4313-9c2f-f34d45611b6f
… ranges Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/d7861818-9499-4047-9741-29d80f9bfd2a
Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/6f3e15a9-c839-4abd-9dcf-00432f1530bf
rangeOf test helper for readable assertions…ponse type Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/ab4f4d56-a31a-4512-88a1-b261f1b0d1a2
There was a problem hiding this comment.
Pull request overview
Adds compiler diagnostic retrieval to the TypeScript-Go API surface, wiring new request methods through the Go session layer and exposing them via the @typescript/api Program (async + generated sync). Also introduces a small test helper to make diagnostic range assertions easier to read.
Changes:
- Add new diagnostic API methods (syntactic/semantic/suggestion/declaration/config parsing/global) to
internal/apiprotocol + session handlers. - Expose the new methods on
_packages/apiProgramand addDiagnostic+DiagnosticCategorytypes. - Add sync/async API tests for each diagnostic method and a
rangeOfhelper for{ pos, end }assertions.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/api/session.go |
Adds request routing + handlers that call program.Get*Diagnostics(...), including optional-file resolution. |
internal/api/proto.go |
Adds method constants, params structs, and diagnostic response serialization (DiagnosticResponse). |
_packages/api/src/async/api.ts |
Adds async Program.get*Diagnostics methods and re-exports DiagnosticCategory. |
_packages/api/src/async/types.ts |
Introduces Diagnostic interface and imports DiagnosticCategory type. |
_packages/api/src/sync/api.ts |
Generated sync counterparts of the new Program.get*Diagnostics methods and exports. |
_packages/api/src/sync/types.ts |
Generated sync Diagnostic interface. |
_packages/api/src/enums/diagnosticCategory.ts |
Adds runtime enum module for DiagnosticCategory (generated). |
_packages/api/src/enums/diagnosticCategory.enum.ts |
Adds type enum module for DiagnosticCategory (generated). |
_packages/api/test/async/api.test.ts |
Adds async coverage for each diagnostics method + rangeOf helper. |
_packages/api/test/sync/api.test.ts |
Adds sync coverage for each diagnostics method + rangeOf helper. |
Herebyfile.mjs |
Registers DiagnosticCategory for enum generation into _packages/api/src/enums. |
|
@copilot address review feedback and format |
Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/efc7826a-2e58-479c-b5bb-c2020c71b7ee Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
Removed Note: I kept the |
|
@copilot just remove getGlobalDiagnostics from the API for now. |
Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/d4721030-7ecc-47da-af0e-b0c054c3fca3 Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
…sertions Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/c4f0c1b6-89ad-4d05-beba-fb6a983a7d1b Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
Adds
getSyntacticDiagnostics,getSemanticDiagnostics,getSuggestionDiagnostics,getConfigFileParsingDiagnostics, andgetDeclarationDiagnosticsto the API surface.Diagnostic API
Programmethods that call through to the Go server, plus auto-generated sync variantsDiagnosticdirectly (no intermediate wire type needed since the shapes are identical at runtime)reportsUnnecessary/reportsDeprecateduseomitzerosofalseis omitted from JSON and the TS types remain optional booleans — onlytrueis sent on the wiregetGlobalDiagnosticsis excluded for now due to a pre-existing checker pool type assertion issue in the compilerTest helper:
rangeOfTests use
assert.deepEqualwith exact expected values. ArangeOf(source, searchString, occurrence?)helper computes{ pos, end }viaindexOf, replacing opaque magic numbers with human-readable assertions:occurrenceis 0-based (default0). One test per diagnostic method; the semantic test covers bothmessageChainandrelatedInformation.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.