Cache the latest source file from document registry so we can keep it alive when script info is orphan

This commit is contained in:
Sheetal Nandi
2018-05-15 17:10:40 -07:00
parent 59d19251cf
commit 81ca6502ea
4 changed files with 60 additions and 8 deletions

View File

@@ -202,6 +202,12 @@ namespace ts.server {
return fileName[0] === "^" || getBaseFileName(fileName)[0] === "^";
}
/*@internal*/
export interface DocumentRegistrySourceFileCache {
key: DocumentRegistryBucketKey;
sourceFile: SourceFile;
}
export class ScriptInfo {
/**
* All projects that include this file
@@ -221,6 +227,9 @@ namespace ts.server {
/** Set to real path if path is different from info.path */
private realpath: Path | undefined;
/*@internal*/
cacheSourceFile: DocumentRegistrySourceFileCache;
constructor(
private readonly host: ServerHost,
readonly fileName: NormalizedPath,