Keep alive declaration script info and map file info if source file info is alive

This commit is contained in:
Sheetal Nandi
2018-11-29 14:14:45 -08:00
parent 0aa4da43ad
commit 56a39b754c
7 changed files with 47 additions and 27 deletions

View File

@@ -64,14 +64,20 @@ namespace ts.server {
this.switchToScriptVersionCache();
}
private resetSourceMapInfo() {
this.info.mapper = undefined;
this.info.sourceFileLike = undefined;
this.info.mapInfo = undefined;
this.info.sourceInfos = undefined;
}
/** Public for testing */
public useText(newText?: string) {
this.svc = undefined;
this.text = newText;
this.lineMap = undefined;
this.fileSize = undefined;
this.info.mapper = undefined;
this.info.sourceFileLike = undefined;
this.resetSourceMapInfo();
this.version.text++;
}
@@ -81,8 +87,7 @@ namespace ts.server {
this.text = undefined;
this.lineMap = undefined;
this.fileSize = undefined;
this.info.mapper = undefined;
this.info.sourceFileLike = undefined;
this.resetSourceMapInfo();
}
/**
@@ -304,7 +309,7 @@ namespace ts.server {
/*@internal*/
sourceInfos?: Map<true>;
/*@internal*/
mapper: DocumentPositionMapper | false | undefined = false;
mapper?: DocumentPositionMapper | false;
/*@internal*/
sourceFileLike: SourceFileLike | undefined;