@@ -625,7 +625,7 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit
625625 }
626626
627627 if moduleSymbol := checker .GetMergedSymbol (resolvedRef .file .Symbol ); moduleSymbol != nil {
628- return getReferencedSymbolsForModule (ctx , program , moduleSymbol /*excludeImportTypeOfExportEquals*/ , false , sourceFiles , sourceFilesSet )
628+ return l . getReferencedSymbolsForModule (ctx , program , moduleSymbol /*excludeImportTypeOfExportEquals*/ , false , sourceFiles , sourceFilesSet )
629629 }
630630
631631 // !!! not implemented
@@ -673,7 +673,7 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit
673673 }
674674
675675 if symbol .Name == ast .InternalSymbolNameExportEquals {
676- return getReferencedSymbolsForModule (ctx , program , symbol .Parent , false /*excludeImportTypeOfExportEquals*/ , sourceFiles , sourceFilesSet )
676+ return l . getReferencedSymbolsForModule (ctx , program , symbol .Parent , false /*excludeImportTypeOfExportEquals*/ , sourceFiles , sourceFilesSet )
677677 }
678678
679679 moduleReferences := l .getReferencedSymbolsForModuleIfDeclaredBySourceFile (ctx , symbol , program , sourceFiles , checker , options , sourceFilesSet ) // !!! cancellationToken
@@ -700,7 +700,7 @@ func (l *LanguageService) getReferencedSymbolsForModuleIfDeclaredBySourceFile(ct
700700 }
701701 exportEquals := symbol .Exports [ast .InternalSymbolNameExportEquals ]
702702 // If exportEquals != nil, we're about to add references to `import("mod")` anyway, so don't double-count them.
703- moduleReferences := getReferencedSymbolsForModule (ctx , program , symbol , exportEquals != nil , sourceFiles , sourceFilesSet )
703+ moduleReferences := l . getReferencedSymbolsForModule (ctx , program , symbol , exportEquals != nil , sourceFiles , sourceFilesSet )
704704 if exportEquals == nil || ! sourceFilesSet .Has (moduleSourceFileName ) {
705705 return moduleReferences
706706 }
@@ -1021,7 +1021,7 @@ func getMergedAliasedSymbolOfNamespaceExportDeclaration(node *ast.Node, symbol *
10211021 return nil
10221022}
10231023
1024- func getReferencedSymbolsForModule (ctx context.Context , program * compiler.Program , symbol * ast.Symbol , excludeImportTypeOfExportEquals bool , sourceFiles []* ast.SourceFile , sourceFilesSet * collections.Set [string ]) []* SymbolAndEntries {
1024+ func ( l * LanguageService ) getReferencedSymbolsForModule (ctx context.Context , program * compiler.Program , symbol * ast.Symbol , excludeImportTypeOfExportEquals bool , sourceFiles []* ast.SourceFile , sourceFilesSet * collections.Set [string ]) []* SymbolAndEntries {
10251025 debug .Assert (symbol .ValueDeclaration != nil )
10261026
10271027 checker , done := program .GetTypeChecker (ctx )
@@ -1062,10 +1062,11 @@ func getReferencedSymbolsForModule(ctx context.Context, program *compiler.Progra
10621062 }
10631063 return newNodeEntry (rangeNode )
10641064 case ModuleReferenceKindReference :
1065- // <reference path> or <reference types>
1066- // We can't easily create a proper range entry here without access to LanguageService,
1067- // but we can create a node-based entry pointing to the source file which will be resolved later
1068- return newNodeEntry (reference .referencingFile .AsNode ())
1065+ return & referenceEntry {
1066+ kind : entryKindRange ,
1067+ fileName : reference .referencingFile .FileName (),
1068+ textRange : l .createLspRangeFromBounds (reference .ref .Pos (), reference .ref .End (), reference .referencingFile ),
1069+ }
10691070 }
10701071 return nil
10711072 })
0 commit comments