DocumentRegistry
The document registry represents a store of SourceFile objects that can be shared between multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) of files in the context. SourceFile objects account for most of the memory usage by the language service. Sharing the same DocumentRegistry instance between different instances of LanguageService allow for more efficient memory utilization since all projects will share at least the library file (lib.d.ts).
A more advanced use of the document registry is to serialize sourceFile objects to disk and re-hydrate them when needed.
To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it to all subsequent createLanguageService calls.
Functions
Request a stored SourceFile with a given fileName and compilationSettings. The first call to acquire will call createLanguageServiceSourceFile to generate the SourceFile if was not found in the registry.
Informs the DocumentRegistry that a file is not needed any longer.
Request an updated version of an already existing SourceFile with a given fileName and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile to get an updated SourceFile.