Skip to content

API: make object registries project-specific to avoid id collisions on types and signatures#4341

Open
piotrtomiak wants to merge 4 commits into
microsoft:mainfrom
JetBrains:api-fix-id-collisions
Open

API: make object registries project-specific to avoid id collisions on types and signatures#4341
piotrtomiak wants to merge 4 commits into
microsoft:mainfrom
JetBrains:api-fix-id-collisions

Conversation

@piotrtomiak

Copy link
Copy Markdown
Contributor

It will also make it easier to refactor checker method into Type/Symbol/Signature classes.

Copilot AI review requested due to automatic review settings June 16, 2026 19:10

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds API support for extracting the true/false branches of conditional types, and fixes cross-project handle collisions by scoping type/symbol/signature registries per project within a snapshot.

Changes:

  • Introduced getTrueTypeOfConditionalType / getFalseTypeOfConditionalType methods end-to-end (checker exports, API proto, session handlers, TS clients, tests).
  • Replaced snapshot-global registries with per-project registries to prevent ID collisions when multiple projects are open in the same snapshot.
  • Updated sub-property endpoint params to include project so the server can resolve handles in the correct project registry.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/checker/exports.go Exposes conditional-type true/false branch getters on Checker.
internal/api/session.go Scopes registries per project; threads projectID through registration/handle-resolution and adds new API handlers.
internal/api/proto.go Adds new method names + unmarshalers; adds project to sub-property param types.
_packages/native-preview/src/api/sync/api.ts Moves object registries from snapshot-level to project-level; adds conditional-type branch methods.
_packages/native-preview/src/api/async/api.ts Async equivalent of sync client changes (project-level registries + new methods).
_packages/native-preview/test/sync/api.test.ts Adds tests for conditional-type branch getters and multi-project type ID collision regression.
_packages/native-preview/test/async/api.test.ts Async equivalent tests for new methods and multi-project collision regression.

Comment thread internal/api/session.go
Comment thread internal/api/proto.go
Comment thread _packages/native-preview/src/api/sync/api.ts
Comment thread _packages/native-preview/test/sync/api.test.ts
Comment thread internal/api/session.go
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