fix(typescript): avoid OOM in check-types by batching tsserver open/close#10351
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent bit check-types from hanging or OOM’ing in large workspaces by changing the tsserver interaction so TypeScript projects aren’t all loaded into memory at once.
Changes:
- Add CLI status-line progress messages during
check-typesexecution. - Add
openFilesOnInit?: booleantoTsserverClientso callers can skip pre-opening all files during init. - Update
TsserverClient.getDiagnostic()to (intended) open/check/close files in batches to bound tsserver memory usage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| scopes/typescript/typescript/cmds/check-types.cmd.ts | Sets status lines for progress and disables pre-opening files on tsserver init so diagnostics can be batched. |
| scopes/typescript/ts-server/ts-server-client.ts | Adds openFilesOnInit and implements batched UpdateOpen open/close behavior around geterr, plus progress status line. |
GiladShoham
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bit check-typesopened every.ts/.tsxfile in the workspace upfront viaPromise.all, so tsserver loaded the closest tsconfig project for each file and held them all in memory. The existingBATCH_SIZE=50only batched thegeterrcall — by then everything was already loaded, so it never bounded memory and large workspaces would hang or OOM.Now files are opened and closed in batches inside
getDiagnostic(oneupdateOpenround-trip per batch), so tsserver only holds one batch's worth of files at a time. Added a status line so the run shows progress instead of looking hung.No new flags or memory tuning — defaults are unchanged.