@@ -227,9 +227,9 @@ namespace ts.codefix {
227
227
228
228
function getAllReExportingModules ( importingFile : SourceFile , exportedSymbol : Symbol , exportingModuleSymbol : Symbol , symbolName : string , host : LanguageServiceHost , program : Program , autoImportProvider : Program | undefined ) : readonly SymbolExportInfo [ ] {
229
229
const result : SymbolExportInfo [ ] = [ ] ;
230
- const checker = program . getTypeChecker ( ) ;
231
230
const compilerOptions = program . getCompilerOptions ( ) ;
232
- forEachExternalModuleFromEachAutoImportProvider ( program , autoImportProvider , host , importingFile , /*filterByPackageJson*/ false , ( moduleSymbol , moduleFile ) => {
231
+ forEachExternalModuleToImportFrom ( program , autoImportProvider , host , importingFile , /*filterByPackageJson*/ false , ( moduleSymbol , moduleFile , program ) => {
232
+ const checker = program . getTypeChecker ( ) ;
233
233
// Don't import from a re-export when looking "up" like to `./index` or `../index`.
234
234
if ( moduleFile && moduleSymbol !== exportingModuleSymbol && startsWith ( importingFile . fileName , getDirectoryPath ( moduleFile . fileName ) ) ) {
235
235
return ;
@@ -523,7 +523,7 @@ namespace ts.codefix {
523
523
function addSymbol ( moduleSymbol : Symbol , exportedSymbol : Symbol , importKind : ImportKind ) : void {
524
524
originalSymbolToExportInfos . add ( getUniqueSymbolId ( exportedSymbol , checker ) . toString ( ) , { moduleSymbol, importKind, exportedSymbolIsTypeOnly : isTypeOnlySymbol ( exportedSymbol , checker ) } ) ;
525
525
}
526
- forEachExternalModuleFromEachAutoImportProvider ( program , autoImportProvider , host , sourceFile , /*filterByPackageJson*/ true , moduleSymbol => {
526
+ forEachExternalModuleToImportFrom ( program , autoImportProvider , host , sourceFile , /*filterByPackageJson*/ true , moduleSymbol => {
527
527
cancellationToken . throwIfCancellationRequested ( ) ;
528
528
529
529
const defaultInfo = getDefaultLikeExportInfo ( sourceFile , moduleSymbol , checker , program . getCompilerOptions ( ) ) ;
@@ -788,23 +788,23 @@ namespace ts.codefix {
788
788
return some ( declarations , decl => ! ! ( getMeaningFromDeclaration ( decl ) & meaning ) ) ;
789
789
}
790
790
791
- export function forEachExternalModuleFromEachAutoImportProvider (
791
+ export function forEachExternalModuleToImportFrom (
792
792
program : Program ,
793
793
autoImportProvider : Program | undefined ,
794
794
host : LanguageServiceHost ,
795
795
from : SourceFile ,
796
796
filterByPackageJson : boolean ,
797
797
cb : ( module : Symbol , moduleFile : SourceFile | undefined , program : Program ) => void ,
798
798
) {
799
- forEachExternalModuleToImportFrom ( program , host , from , filterByPackageJson , ( module , file ) => cb ( module , file , program ) ) ;
799
+ forEachExternalModuleToImportFromInProgram ( program , host , from , filterByPackageJson , ( module , file ) => cb ( module , file , program ) ) ;
800
800
if ( autoImportProvider ) {
801
801
const start = timestamp ( ) ;
802
- forEachExternalModuleToImportFrom ( autoImportProvider , host , from , filterByPackageJson , ( module , file ) => cb ( module , file , autoImportProvider ) ) ;
802
+ forEachExternalModuleToImportFromInProgram ( autoImportProvider , host , from , filterByPackageJson , ( module , file ) => cb ( module , file , autoImportProvider ) ) ;
803
803
host . log ?.( `forEachExternalModuleToImportFrom autoImportProvider: ${ timestamp ( ) - start } ` ) ;
804
804
}
805
805
}
806
806
807
- function forEachExternalModuleToImportFrom (
807
+ function forEachExternalModuleToImportFromInProgram (
808
808
program : Program ,
809
809
host : LanguageServiceHost ,
810
810
from : SourceFile ,
0 commit comments