Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilerHost never reuses SourceFile instances #1113

Open
cspotcode opened this issue Aug 12, 2020 · 0 comments
Open

compilerHost never reuses SourceFile instances #1113

cspotcode opened this issue Aug 12, 2020 · 0 comments

Comments

@cspotcode
Copy link
Collaborator

I'm not sure if this is a bug or what. But if I hook into the CompilerHost's getSourceFile function, it never reuses a pre-existing SourceFile. It always returns new ones. This implementation of getSourceFile is provided by ts.createIncrementalCompilerHost.

Are we meant to wrap the CompilerHost to implement caching ourselves? Does TypeScript do this sort of wrapping internally?

I've definitely looked at those parts of the TS codebase before, but I forget, so I'll need to look again.

LanguageService does this automatically via DocumentRegistry. The CompilerHost APIs don't have a way to pass in a DocumentRegistry.

@cspotcode cspotcode added this to the next milestone May 15, 2021
@cspotcode cspotcode modified the milestones: 10.2.0, next, 10.3.0 Aug 8, 2021
@cspotcode cspotcode removed this from the 10.3.0 milestone Oct 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant