@@ -32,23 +32,20 @@ namespace ts {
3232 }
3333
3434 function getImportsToUpdate ( program : Program , oldFilePath : string , host : LanguageServiceHost ) : ReadonlyArray < ToUpdate > {
35- const checker = program . getTypeChecker ( ) ;
3635 const result : ToUpdate [ ] = [ ] ;
3736 for ( const sourceFile of program . getSourceFiles ( ) ) {
3837 for ( const ref of sourceFile . referencedFiles ) {
39- if ( ! program . getSourceFileFromReference ( sourceFile , ref ) && resolveTripleslashReference ( ref . fileName , sourceFile . fileName ) === oldFilePath ) {
38+ if ( resolveTripleslashReference ( ref . fileName , sourceFile . fileName ) === oldFilePath ) {
4039 result . push ( { sourceFile, toUpdate : ref } ) ;
4140 }
4241 }
4342
4443 for ( const importStringLiteral of sourceFile . imports ) {
45- // If it resolved to something already, ignore.
46- if ( checker . getSymbolAtLocation ( importStringLiteral ) ) continue ;
47-
4844 const resolved = host . resolveModuleNames
4945 ? host . getResolvedModuleWithFailedLookupLocationsFromCache && host . getResolvedModuleWithFailedLookupLocationsFromCache ( importStringLiteral . text , sourceFile . fileName )
5046 : program . getResolvedModuleWithFailedLookupLocationsFromCache ( importStringLiteral . text , sourceFile . fileName ) ;
51- if ( resolved && contains ( resolved . failedLookupLocations , oldFilePath ) ) {
47+ // 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
48+ if ( resolved && contains ( resolved . resolvedModule ? [ resolved . resolvedModule . resolvedFileName ] : resolved . failedLookupLocations , oldFilePath ) ) {
5249 result . push ( { sourceFile, toUpdate : importStringLiteral } ) ;
5350 }
5451 }
0 commit comments