@@ -283,13 +283,13 @@ namespace ts {
283
283
newLine = updateNewLine ( ) ;
284
284
}
285
285
286
- const { watchFile, watchFilePath , watchDirectory, writeLog } = createWatchFactory < string > ( host , compilerOptions ) ;
286
+ const { watchFile, watchDirectory, writeLog } = createWatchFactory ( host , compilerOptions ) ;
287
287
const getCanonicalFileName = createGetCanonicalFileName ( useCaseSensitiveFileNames ) ;
288
288
289
289
writeLog ( `Current directory: ${ currentDirectory } CaseSensitiveFileNames: ${ useCaseSensitiveFileNames } ` ) ;
290
290
let configFileWatcher : FileWatcher | undefined ;
291
291
if ( configFileName ) {
292
- configFileWatcher = watchFile ( host , configFileName , scheduleProgramReload , PollingInterval . High , watchOptions , WatchType . ConfigFile ) ;
292
+ configFileWatcher = watchFile ( configFileName , scheduleProgramReload , PollingInterval . High , watchOptions , WatchType . ConfigFile ) ;
293
293
}
294
294
295
295
const compilerHost = createCompilerHostFromProgramHost ( host , ( ) => compilerOptions , directoryStructureHost ) as CompilerHost & ResolutionCacheHost ;
@@ -305,8 +305,8 @@ namespace ts {
305
305
compilerHost . toPath = toPath ;
306
306
compilerHost . getCompilationSettings = ( ) => compilerOptions ;
307
307
compilerHost . useSourceOfProjectReferenceRedirect = maybeBind ( host , host . useSourceOfProjectReferenceRedirect ) ;
308
- compilerHost . watchDirectoryOfFailedLookupLocation = ( dir , cb , flags ) => watchDirectory ( host , dir , cb , flags , watchOptions , WatchType . FailedLookupLocations ) ;
309
- compilerHost . watchTypeRootsDirectory = ( dir , cb , flags ) => watchDirectory ( host , dir , cb , flags , watchOptions , WatchType . TypeRoots ) ;
308
+ compilerHost . watchDirectoryOfFailedLookupLocation = ( dir , cb , flags ) => watchDirectory ( dir , cb , flags , watchOptions , WatchType . FailedLookupLocations ) ;
309
+ compilerHost . watchTypeRootsDirectory = ( dir , cb , flags ) => watchDirectory ( dir , cb , flags , watchOptions , WatchType . TypeRoots ) ;
310
310
compilerHost . getCachedDirectoryStructureHost = ( ) => cachedDirectoryStructureHost ;
311
311
compilerHost . scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations ;
312
312
compilerHost . onInvalidatedResolution = scheduleProgramUpdate ;
@@ -488,7 +488,7 @@ namespace ts {
488
488
( hostSourceFile as FilePresentOnHost ) . sourceFile = sourceFile ;
489
489
hostSourceFile . version = sourceFile . version ;
490
490
if ( ! hostSourceFile . fileWatcher ) {
491
- hostSourceFile . fileWatcher = watchFilePath ( host , fileName , onSourceFileChange , PollingInterval . Low , watchOptions , path , WatchType . SourceFile ) ;
491
+ hostSourceFile . fileWatcher = watchFilePath ( path , fileName , onSourceFileChange , PollingInterval . Low , watchOptions , WatchType . SourceFile ) ;
492
492
}
493
493
}
494
494
else {
@@ -501,7 +501,7 @@ namespace ts {
501
501
}
502
502
else {
503
503
if ( sourceFile ) {
504
- const fileWatcher = watchFilePath ( host , fileName , onSourceFileChange , PollingInterval . Low , watchOptions , path , WatchType . SourceFile ) ;
504
+ const fileWatcher = watchFilePath ( path , fileName , onSourceFileChange , PollingInterval . Low , watchOptions , WatchType . SourceFile ) ;
505
505
sourceFilesCache . set ( path , { sourceFile, version : sourceFile . version , fileWatcher } ) ;
506
506
}
507
507
else {
@@ -675,6 +675,17 @@ namespace ts {
675
675
hasChangedConfigFileParsingErrors = true ;
676
676
}
677
677
678
+ function watchFilePath (
679
+ path : Path ,
680
+ file : string ,
681
+ callback : ( fileName : string , eventKind : FileWatcherEventKind , filePath : Path ) => void ,
682
+ pollingInterval : PollingInterval ,
683
+ options : WatchOptions | undefined ,
684
+ watchType : WatchType
685
+ ) : FileWatcher {
686
+ return watchFile ( file , ( fileName , eventKind ) => callback ( fileName , eventKind , path ) , pollingInterval , options , watchType ) ;
687
+ }
688
+
678
689
function onSourceFileChange ( fileName : string , eventKind : FileWatcherEventKind , path : Path ) {
679
690
updateCachedSystemWithFile ( fileName , path , eventKind ) ;
680
691
@@ -696,7 +707,7 @@ namespace ts {
696
707
}
697
708
698
709
function watchMissingFilePath ( missingFilePath : Path ) {
699
- return watchFilePath ( host , missingFilePath , onMissingFileChange , PollingInterval . Medium , watchOptions , missingFilePath , WatchType . MissingFile ) ;
710
+ return watchFilePath ( missingFilePath , missingFilePath , onMissingFileChange , PollingInterval . Medium , watchOptions , WatchType . MissingFile ) ;
700
711
}
701
712
702
713
function onMissingFileChange ( fileName : string , eventKind : FileWatcherEventKind , missingFilePath : Path ) {
@@ -729,7 +740,6 @@ namespace ts {
729
740
730
741
function watchWildcardDirectory ( directory : string , flags : WatchDirectoryFlags ) {
731
742
return watchDirectory (
732
- host ,
733
743
directory ,
734
744
fileOrDirectory => {
735
745
Debug . assert ( ! ! configFileName ) ;
0 commit comments