Skip to content

Commit 99776c0

Browse files
committed
Simplify symbol index query
1 parent ba65300 commit 99776c0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,10 @@ class SymbolIndex {
9696
}
9797

9898
fun query(prefix: String, receiverType: FqName? = null, limit: Int = 20): List<Symbol> = transaction(db) {
99+
// TODO: Extension completion currently only works if the receiver matches exactly,
100+
// ideally this should work with subtypes as well
99101
(Symbols innerJoin FqNames)
100-
.select {
101-
FqNames.shortName
102-
.like("$prefix%")
103-
.let { q ->
104-
receiverType?.let { t ->
105-
q and (Symbols.extensionReceiverType eq wrapAsExpression(FqNames.slice(FqNames.fqName.count()).select { FqNames.shortName.like("$t%") }))
106-
} ?: q
107-
}
108-
}
102+
.select { FqNames.shortName.like("$prefix%") and (Symbols.extensionReceiverType eq receiverType?.toString()) }
109103
.limit(limit)
110104
.map { Symbol(
111105
fqName = FqName(it[Symbols.fqName]),

0 commit comments

Comments
 (0)