@@ -141,7 +141,7 @@ export interface ResolutionCache {
141141
142142 invalidateResolutionsOfFailedLookupLocations ( ) : boolean ;
143143 invalidateResolutionOfFile ( filePath : Path ) : void ;
144- removeResolutionsOfFile ( filePath : Path , syncDirWatcherRemove ?: boolean ) : void ;
144+ removeResolutionsOfFile ( filePath : Path ) : void ;
145145 removeResolutionsFromProjectReferenceRedirects ( filePath : Path ) : void ;
146146 setFilesWithInvalidatedNonRelativeUnresolvedImports ( filesWithUnresolvedImports : Map < Path , readonly string [ ] > ) : void ;
147147 createHasInvalidatedResolutions (
@@ -1273,7 +1273,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
12731273 else if ( packageDirWatcher . isSymlink !== isSymlink ) {
12741274 // Handle the change
12751275 packageDirWatcher . dirPathToWatcher . forEach ( watcher => {
1276- removeDirectoryWatcher ( packageDirWatcher ! . isSymlink ? packageDirPath : dirPath , /*syncDirWatcherRemove*/ false ) ;
1276+ removeDirectoryWatcher ( packageDirWatcher ! . isSymlink ? packageDirPath : dirPath ) ;
12771277 watcher . watcher = createDirPathToWatcher ( ) ;
12781278 } ) ;
12791279 packageDirWatcher . isSymlink = isSymlink ;
@@ -1329,7 +1329,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
13291329 return dirWatcher ;
13301330 }
13311331
1332- function stopWatchFailedLookupLocation ( failedLookupLocation : string , removeAtRoot : boolean , syncDirWatcherRemove : boolean | undefined ) {
1332+ function stopWatchFailedLookupLocation ( failedLookupLocation : string , removeAtRoot : boolean ) {
13331333 const failedLookupLocationPath = resolutionHost . toPath ( failedLookupLocation ) ;
13341334 const toWatch = getDirectoryToWatchFailedLookupLocation (
13351335 failedLookupLocation ,
@@ -1350,7 +1350,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
13501350 const forDirPath = packageDirWatcher . dirPathToWatcher . get ( dirPath ) ! ;
13511351 forDirPath . refCount -- ;
13521352 if ( forDirPath . refCount === 0 ) {
1353- removeDirectoryWatcher ( packageDirWatcher . isSymlink ? packageDirPath : dirPath , syncDirWatcherRemove ) ;
1353+ removeDirectoryWatcher ( packageDirWatcher . isSymlink ? packageDirPath : dirPath ) ;
13541354 packageDirWatcher . dirPathToWatcher . delete ( dirPath ) ;
13551355 if ( packageDirWatcher . isSymlink ) {
13561356 const refCount = dirPathToSymlinkPackageRefCount . get ( dirPath ) ! - 1 ;
@@ -1361,11 +1361,10 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
13611361 dirPathToSymlinkPackageRefCount . set ( dirPath , refCount ) ;
13621362 }
13631363 }
1364- if ( syncDirWatcherRemove ) closePackageDirWatcher ( packageDirWatcher , packageDirPath ) ;
13651364 }
13661365 }
13671366 else {
1368- removeDirectoryWatcher ( dirPath , syncDirWatcherRemove ) ;
1367+ removeDirectoryWatcher ( dirPath ) ;
13691368 }
13701369 }
13711370 return removeAtRoot ;
@@ -1375,7 +1374,6 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
13751374 resolution : T ,
13761375 filePath : Path ,
13771376 getResolutionWithResolvedFileName : GetResolutionWithResolvedFileName < T , R > ,
1378- syncDirWatcherRemove ?: boolean ,
13791377 ) {
13801378 Debug . checkDefined ( resolution . files ) . delete ( filePath ) ;
13811379 if ( resolution . files ! . size ) return ;
@@ -1392,11 +1390,11 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
13921390 let removeAtRoot = false ;
13931391 if ( failedLookupLocations ) {
13941392 for ( const failedLookupLocation of failedLookupLocations ) {
1395- removeAtRoot = stopWatchFailedLookupLocation ( failedLookupLocation , removeAtRoot , syncDirWatcherRemove ) ;
1393+ removeAtRoot = stopWatchFailedLookupLocation ( failedLookupLocation , removeAtRoot ) ;
13961394 }
13971395 }
1398- if ( alternateResult ) removeAtRoot = stopWatchFailedLookupLocation ( alternateResult , removeAtRoot , syncDirWatcherRemove ) ;
1399- if ( removeAtRoot ) removeDirectoryWatcher ( rootPath , syncDirWatcherRemove ) ;
1396+ if ( alternateResult ) removeAtRoot = stopWatchFailedLookupLocation ( alternateResult , removeAtRoot ) ;
1397+ if ( removeAtRoot ) removeDirectoryWatcher ( rootPath ) ;
14001398 }
14011399 else if ( affectingLocations ?. length ) {
14021400 resolutionsWithOnlyAffectingLocations . delete ( resolution ) ;
@@ -1406,16 +1404,14 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
14061404 for ( const affectingLocation of affectingLocations ) {
14071405 const watcher = fileWatchesOfAffectingLocations . get ( affectingLocation ) ! ;
14081406 watcher . resolutions -- ;
1409- if ( syncDirWatcherRemove ) closeFileWatcherOfAffectingLocation ( watcher , affectingLocation ) ;
14101407 }
14111408 }
14121409 }
14131410
1414- function removeDirectoryWatcher ( dirPath : Path , syncDirWatcherRemove : boolean | undefined ) {
1411+ function removeDirectoryWatcher ( dirPath : Path ) {
14151412 const dirWatcher = directoryWatchesOfFailedLookups . get ( dirPath ) ! ;
14161413 // Do not close the watcher yet since it might be needed by other failed lookup locations.
14171414 dirWatcher . refCount -- ;
1418- if ( syncDirWatcherRemove ) closeDirectoryWatchesOfFailedLookup ( dirWatcher , dirPath ) ;
14191415 }
14201416
14211417 function createDirectoryWatcher ( directory : string , dirPath : Path , nonRecursive : boolean | undefined ) {
@@ -1434,7 +1430,6 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
14341430 cache : Map < string , ModeAwareCache < T > > ,
14351431 filePath : Path ,
14361432 getResolutionWithResolvedFileName : GetResolutionWithResolvedFileName < T , R > ,
1437- syncDirWatcherRemove : boolean | undefined ,
14381433 ) {
14391434 // Deleted file, stop watching failed lookups for all the resolutions in the file
14401435 const resolutions = cache . get ( filePath ) ;
@@ -1444,7 +1439,6 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
14441439 resolution ,
14451440 filePath ,
14461441 getResolutionWithResolvedFileName ,
1447- syncDirWatcherRemove ,
14481442 )
14491443 ) ;
14501444 cache . delete ( filePath ) ;
@@ -1465,9 +1459,9 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
14651459 resolvedProjectReference . commandLine . fileNames . forEach ( f => removeResolutionsOfFile ( resolutionHost . toPath ( f ) ) ) ;
14661460 }
14671461
1468- function removeResolutionsOfFile ( filePath : Path , syncDirWatcherRemove ?: boolean ) {
1469- removeResolutionsOfFileFromCache ( resolvedModuleNames , filePath , getResolvedModuleFromResolution , syncDirWatcherRemove ) ;
1470- removeResolutionsOfFileFromCache ( resolvedTypeReferenceDirectives , filePath , getResolvedTypeReferenceDirectiveFromResolution , syncDirWatcherRemove ) ;
1462+ function removeResolutionsOfFile ( filePath : Path ) {
1463+ removeResolutionsOfFileFromCache ( resolvedModuleNames , filePath , getResolvedModuleFromResolution ) ;
1464+ removeResolutionsOfFileFromCache ( resolvedTypeReferenceDirectives , filePath , getResolvedTypeReferenceDirectiveFromResolution ) ;
14711465 }
14721466
14731467 function invalidateResolutions ( resolutions : Set < ResolutionWithFailedLookupLocations > | Map < string , ResolutionWithFailedLookupLocations > | undefined , canInvalidate : ( resolution : ResolutionWithFailedLookupLocations ) => boolean | undefined ) {
0 commit comments