Implementation of watching the failed lookup locations

This commit is contained in:
Sheetal Nandi
2017-08-07 11:31:13 -07:00
parent 65a6ee07e9
commit d55150cbd3
3 changed files with 102 additions and 3 deletions
+12 -1
View File
@@ -271,7 +271,13 @@ namespace ts {
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
// Cache for the module resolution
const resolutionCache = createResolutionCache(fileName => toPath(fileName), () => compilerOptions);
const resolutionCache = createResolutionCache(
fileName => toPath(fileName),
() => compilerOptions,
() => clearExistingProgramAndScheduleProgramUpdate(),
(fileName, callback) => system.watchFile(fileName, callback),
s => writeLog(s)
);
// There is no extra check needed since we can just rely on the program to decide emit
const builder = createBuilder(getCanonicalFileName, getFileEmitOutput, computeHash, _sourceFile => true);
@@ -465,6 +471,11 @@ namespace ts {
scheduleProgramUpdate();
}
function clearExistingProgramAndScheduleProgramUpdate() {
program = undefined;
scheduleProgramUpdate();
}
function updateProgram() {
timerToUpdateProgram = undefined;
reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation));