Skip to content

Run symbol-returning completion on the API checker#4480

Merged
andrewbranch merged 1 commit into
microsoft:mainfrom
JetBrains:fix-handleGetCompletionsAtPosition
Jun 30, 2026
Merged

Run symbol-returning completion on the API checker#4480
andrewbranch merged 1 commit into
microsoft:mainfrom
JetBrains:fix-handleGetCompletionsAtPosition

Conversation

@Vorobey31415

Copy link
Copy Markdown
Contributor

Set CheckerLifetimeAPI in handleGetCompletionsAtPosition so completion symbols resolve on the same checker GetTypeOfSymbol uses, fixing a nil-pointer panic (e.g. people. where people: string[]). Document the rule on setupLanguageService and add a regression test

Set CheckerLifetimeAPI in handleGetCompletionsAtPosition so completion symbols resolve on the same checker GetTypeOfSymbol uses, fixing a nil-pointer panic (e.g. `people.` where `people: string[]`). Document the rule on setupLanguageService and add a regression test
Copilot AI review requested due to automatic review settings June 30, 2026 05:48

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 fixes a nil-pointer panic caused by completion entries returning symbol handles created on an ephemeral checker, which later became unresolvable when clients re-queried symbol types on the persistent API checker. It ensures symbol-producing completions run under CheckerLifetimeAPI, documents the lifecycle rule for setupLanguageService, and adds a regression test.

Changes:

  • Documented how setupLanguageService’s internal checker acquisition interacts with symbol/type handle resolvability and the API checker lifetime.
  • Updated handleGetCompletionsAtPosition to wrap the request context with CheckerLifetimeAPI when IncludeSymbol is requested.
  • Added a regression test that requests completion symbols for string[] members and verifies their types can be resolved without panicking.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/api/session.go Pins symbol-returning completion requests to the API checker lifetime and documents when this is safe.
internal/api/session_completion_test.go Adds regression coverage for resolving types of completion-provided symbols (prevents the nil-pointer crash).

@Vorobey31415

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="JetBrains"

@andrewbranch andrewbranch left a comment

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.

Good catch, thanks!

@andrewbranch andrewbranch enabled auto-merge June 30, 2026 15:57
@andrewbranch andrewbranch added this pull request to the merge queue Jun 30, 2026
Merged via the queue into microsoft:main with commit 1262789 Jun 30, 2026
21 checks passed
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.

3 participants