Skip to content

fix: pass documentRegistry and serverMode to createLanguageService#295

Open
ekazakov14 wants to merge 1 commit intomrmckeb:mainfrom
ekazakov14:fix-external-cache-usage
Open

fix: pass documentRegistry and serverMode to createLanguageService#295
ekazakov14 wants to merge 1 commit intomrmckeb:mainfrom
ekazakov14:fix-external-cache-usage

Conversation

@ekazakov14
Copy link

@ekazakov14 ekazakov14 commented Mar 10, 2026

This adds caching between different monorepository projects

Summary

ts.createLanguageService was called with only the host argument, missing
documentRegistry and languageServiceMode:

  • documentRegistry — without it, the plugin creates an isolated document
    registry instead of sharing the one managed by ProjectService. When multiple
    projects include overlapping files, each gets its own parsed SourceFile
    copies, increasing memory usage.
  • serverMode — without it, the service defaults to full semantic mode
    regardless of the mode the TS server was started with.

Both values are now forwarded from the original ProjectService instance.

Notes

ProjectService.documentRegistry exists at runtime but is typed as private
in TypeScript's declarations, so a type cast is required.

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.

1 participant