Skip to content

Commit 20674d3

Browse files
committed
Add workaround for missing insertIgnore
1 parent 01ab459 commit 20674d3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ class SymbolIndex {
4141
transaction(db) {
4242
Symbols.deleteAll()
4343

44+
// TODO: Workaround, since insertIgnore seems to throw UnsupportedByDialectExceptions
45+
// when used with H2.
46+
val addedFqns = mutableSetOf<FqName>()
47+
4448
for (descriptor in descriptors) {
4549
val fqn = descriptor.fqNameSafe
4650

47-
Symbols.insertIgnore {
48-
it[fqName] = fqn.toString()
49-
it[shortName] = fqn.shortName().toString()
50-
it[kind] = descriptor.accept(ExtractSymbolKind, Unit).rawValue
51+
if (!addedFqns.contains(fqn)) {
52+
addedFqns.add(fqn)
53+
Symbols.insert {
54+
it[fqName] = fqn.toString()
55+
it[shortName] = fqn.shortName().toString()
56+
it[kind] = descriptor.accept(ExtractSymbolKind, Unit).rawValue
57+
}
5158
}
5259
}
5360

0 commit comments

Comments
 (0)