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.
The name of the file requested
Some compilation settings like target affects the shape of a the resulting SourceFile. This allows the DocumentRegistry to store multiple copies of the same file for different compilation settings.
Text of the file. Only used if the file was not found in the registry and a new one was created.
Current version of the file. Only used if the file was not found in the registry and a new one was created.
Informs the DocumentRegistry that a file is not needed any longer.
Note: It is not allowed to call release on a SourceFile that was not acquired from this registry originally.
The name of the file to be released
The compilation settings used to acquire the file
The script kind of the file to be released
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.
The name of the file requested
Some compilation settings like target affects the shape of a the resulting SourceFile. This allows the DocumentRegistry to store multiple copies of the same file for different compilation settings.
Text of the file.
Current version of the file.
Generated using TypeDoc
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.