Watch missing map file and update the source mapping accordingly

This commit is contained in:
Sheetal Nandi
2018-12-05 12:18:14 -08:00
parent 8f3d2d9f76
commit 3dc0d5a77c
4 changed files with 224 additions and 66 deletions

View File

@@ -66,6 +66,7 @@ namespace ts.server {
private resetSourceMapInfo() {
this.info.sourceFileLike = undefined;
this.info.closeSourceMapFileWatcher();
this.info.sourceMapFilePath = undefined;
this.info.declarationInfoPath = undefined;
this.info.sourceInfos = undefined;
@@ -280,6 +281,13 @@ namespace ts.server {
sourceFile: SourceFile;
}
/*@internal*/
export interface SourceMapFileWatcher {
declarationInfoPath: Path;
watcher: FileWatcher;
sourceInfos?: Map<true>;
}
export class ScriptInfo {
/**
* All projects that include this file
@@ -309,7 +317,7 @@ namespace ts.server {
sourceFileLike?: SourceFileLike;
/*@internal*/
sourceMapFilePath?: Path | false;
sourceMapFilePath?: Path | SourceMapFileWatcher | false;
// Present on sourceMapFile info
/*@internal*/
@@ -606,5 +614,13 @@ namespace ts.server {
getLineInfo(): LineInfo {
return this.textStorage.getLineInfo();
}
/*@internal*/
closeSourceMapFileWatcher() {
if (this.sourceMapFilePath && !isString(this.sourceMapFilePath)) {
closeFileWatcherOf(this.sourceMapFilePath);
this.sourceMapFilePath = undefined;
}
}
}
}