Skip to content

Prevent deadlock in getCompletionsAtPosition(..., { includeSymbol: true }) API - #64178

Open
auvred wants to merge 1 commit into
microsoft:mainfrom
auvred:api-completions-with-symbol-prevent-deadlock
Open

Prevent deadlock in getCompletionsAtPosition(..., { includeSymbol: true }) API#64178
auvred wants to merge 1 commit into
microsoft:mainfrom
auvred:api-completions-with-symbol-prevent-deadlock

Conversation

@auvred

@auvred auvred commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #64166

The solution is to remove the program.GetTypeChecker(ctx) call from getExistingImports() and pass the checker explicitly instead.

Copilot AI balanced review requested due to automatic review settings September 5, 2026 05:58
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 5, 2026
@typescript-automation typescript-automation Bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Sep 5, 2026

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.

🟢 Approval recommended

The checker lifetime is consistently propagated, and the regression test covers the deadlocking completion path.

Pull request overview

Prevents API completion deadlocks by reusing the caller’s acquired type checker throughout auto-import processing.

Changes:

  • Pass the active checker into auto-import views and fix generation.
  • Remove nested checker acquisition from existing-import lookup.
  • Add a regression test for includeSymbol: true.
File summaries
File Description
tsc/internal/ls/languageservice.go Passes checkers into auto-import views.
tsc/internal/ls/completions.go Reuses completion checkers for auto-imports.
tsc/internal/ls/codeactions_importfixes.go Threads one checker through import fixes.
tsc/internal/ls/codeactions_fixclassincorrectlyimplementsinterface.go Supplies the existing checker to the view.
tsc/internal/ls/autoimport/view.go Stores the caller-provided checker.
tsc/internal/ls/autoimport/import_adder.go Uses the checker-backed view API.
tsc/internal/ls/autoimport/fix.go Eliminates nested checker acquisition.
tsc/internal/api/session.go Supplies the API checker when constructing a view.
tsc/internal/api/session_completion_test.go Tests the reported deadlock scenario.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Milestone Bug PRs that fix a bug with a specific milestone

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

getCompletionsAtPosition in API deadlocks when used with includeSymbol: true

3 participants