Skip to content

Commit 9e0b83b

Browse files
committed
Ignore root extension receiver types in indexer
1 parent 86ca5d0 commit 9e0b83b

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

server/src/main/kotlin/org/javacs/kt/index/SymbolIndex.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,18 @@ class SymbolIndex {
5959
Symbols.deleteAll()
6060

6161
for (descriptor in descriptors) {
62-
val fqn = descriptor.fqNameSafe
63-
val extensionReceiverFqn = descriptor.accept(ExtractSymbolExtensionReceiverType, Unit)
62+
val descriptorFqn = descriptor.fqNameSafe
63+
val extensionReceiverFqn = descriptor.accept(ExtractSymbolExtensionReceiverType, Unit)?.takeIf { !it.isRoot }
6464

65-
FqNames.replace {
66-
it[fqName] = fqn.toString()
67-
it[shortName] = fqn.shortName().toString()
68-
}
69-
70-
extensionReceiverFqn?.let { rFqn ->
65+
for (fqn in listOf(descriptorFqn, extensionReceiverFqn).filterNotNull()) {
7166
FqNames.replace {
72-
it[fqName] = rFqn.toString()
73-
it[shortName] = rFqn.shortName().toString()
67+
it[fqName] = fqn.toString()
68+
it[shortName] = fqn.shortName().toString()
7469
}
7570
}
7671

7772
Symbols.replace {
78-
it[fqName] = fqn.toString()
73+
it[fqName] = descriptorFqn.toString()
7974
it[kind] = descriptor.accept(ExtractSymbolKind, Unit).rawValue
8075
it[visibility] = descriptor.accept(ExtractSymbolVisibility, Unit).rawValue
8176
it[extensionReceiverType] = extensionReceiverFqn?.toString()

0 commit comments

Comments
 (0)