Skip to content

Commit 0d32570

Browse files
committed
add dirWatcher for "watch" option in tsconfig.json
1 parent da01975 commit 0d32570

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/compiler/tsc.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,16 @@ namespace ts {
432432
return sys.exit(compileResult.exitStatus);
433433
}
434434

435+
if (!directoryWatcher && sys.watchDirectory && configFileName) {
436+
const directory = ts.getDirectoryPath(configFileName);
437+
directoryWatcher = sys.watchDirectory(
438+
// When the configFileName is just "tsconfig.json", the watched directory should be
439+
// the current directory; if there is a given "project" parameter, then the configFileName
440+
// is an absolute file name.
441+
directory == "" ? "." : directory,
442+
watchedDirectoryChanged, /*recursive*/ true);
443+
}
444+
435445
setCachedProgram(compileResult.program);
436446
reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
437447
}

0 commit comments

Comments
 (0)