@@ -31,23 +31,20 @@ namespace ts {
3131 }
3232
3333 function getImportsToUpdate ( program : Program , oldFilePath : string , host : LanguageServiceHost ) : ReadonlyArray < ToUpdate > {
34- const checker = program . getTypeChecker ( ) ;
3534 const result : ToUpdate [ ] = [ ] ;
3635 for ( const sourceFile of program . getSourceFiles ( ) ) {
3736 for ( const ref of sourceFile . referencedFiles ) {
38- if ( ! program . getSourceFileFromReference ( sourceFile , ref ) && resolveTripleslashReference ( ref . fileName , sourceFile . fileName ) === oldFilePath ) {
37+ if ( resolveTripleslashReference ( ref . fileName , sourceFile . fileName ) === oldFilePath ) {
3938 result . push ( { sourceFile, toUpdate : ref } ) ;
4039 }
4140 }
4241
4342 for ( const importStringLiteral of sourceFile . imports ) {
44- // If it resolved to something already, ignore.
45- if ( checker . getSymbolAtLocation ( importStringLiteral ) ) continue ;
46-
4743 const resolved = host . resolveModuleNames
4844 ? host . getResolvedModuleWithFailedLookupLocationsFromCache && host . getResolvedModuleWithFailedLookupLocationsFromCache ( importStringLiteral . text , sourceFile . fileName )
4945 : program . getResolvedModuleWithFailedLookupLocationsFromCache ( importStringLiteral . text , sourceFile . fileName ) ;
50- if ( resolved && contains ( resolved . failedLookupLocations , oldFilePath ) ) {
46+ // We may or may not have picked up on the file being renamed, so maybe successfully resolved to oldFilePath, or maybe that's in failedLookupLocations
47+ if ( resolved && contains ( [ resolved . resolvedModule && resolved . resolvedModule . resolvedFileName , ...resolved . failedLookupLocations ] , oldFilePath ) ) {
5148 result . push ( { sourceFile, toUpdate : importStringLiteral } ) ;
5249 }
5350 }
0 commit comments