Skip to content

Commit 35c7b97

Browse files
committed
revert
1 parent ae28c22 commit 35c7b97

File tree

1 file changed

+3
-39
lines changed

1 file changed

+3
-39
lines changed

internal/ls/findallreferences.go

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit
673673
}
674674

675675
moduleReferences := l.getReferencedSymbolsForModuleIfDeclaredBySourceFile(ctx, symbol, program, sourceFiles, checker, options, sourceFilesSet) // !!! cancellationToken
676-
if moduleReferences != nil && symbol.Flags&ast.SymbolFlagsTransient == 0 {
676+
if moduleReferences != nil && symbol.Flags&ast.SymbolFlagsTransient != 0 {
677677
return moduleReferences
678678
}
679679

@@ -976,44 +976,8 @@ func getMergedAliasedSymbolOfNamespaceExportDeclaration(node *ast.Node, symbol *
976976
}
977977

978978
func getReferencedSymbolsForModule(program *compiler.Program, symbol *ast.Symbol, excludeImportTypeOfExportEquals bool, sourceFiles []*ast.SourceFile, sourceFilesSet *collections.Set[string]) []*SymbolAndEntries {
979-
// Minimal implementation to prevent crashes when highlighting import paths.
980-
// This returns module declarations as references, which allows the early return
981-
// in getReferencedSymbolsForNode to work properly and avoid the panic in
982-
// skipPastExportOrImportSpecifierOrUnion.
983-
984-
var references []*referenceEntry
985-
986-
// Add the module declarations themselves as references
987-
if symbol.Declarations != nil {
988-
for _, decl := range symbol.Declarations {
989-
switch decl.Kind {
990-
case ast.KindSourceFile:
991-
// Don't include the source file itself
992-
case ast.KindModuleDeclaration:
993-
sourceFile := ast.GetSourceFileOfNode(decl)
994-
if sourceFilesSet.Has(sourceFile.FileName()) {
995-
references = append(references, &referenceEntry{
996-
kind: entryKindNode,
997-
node: decl.AsModuleDeclaration().Name(),
998-
fileName: sourceFile.FileName(),
999-
})
1000-
}
1001-
default:
1002-
// This may be merged with something
1003-
// TypeScript: Debug.assert(!!(symbol.flags & SymbolFlags.Transient))
1004-
}
1005-
}
1006-
}
1007-
1008-
// Return as SymbolAndEntries even if there are no references
1009-
// This ensures the condition check in getReferencedSymbolsForNode works properly
1010-
return []*SymbolAndEntries{{
1011-
definition: &Definition{
1012-
Kind: definitionKindSymbol,
1013-
symbol: symbol,
1014-
},
1015-
references: references,
1016-
}}
979+
// !!! not implemented
980+
return nil
1017981
}
1018982

1019983
func getReferenceAtPosition(sourceFile *ast.SourceFile, position int, program *compiler.Program) *refInfo {

0 commit comments

Comments
 (0)