Skip to content

Commit 831e2a4

Browse files
author
a.iudin
committed
Replace LookupImpl and LookupUtil with custom JBPopup-based suggestion popup
1 parent 4e54a2f commit 831e2a4

File tree

15 files changed

+765
-224
lines changed

15 files changed

+765
-224
lines changed

src/main/kotlin/ee/carlrobert/codegpt/psistructure/PsiStructureProvider.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ import com.intellij.openapi.application.ReadAction
55
import com.intellij.psi.PsiFile
66
import com.intellij.util.io.await
77
import ee.carlrobert.codegpt.psistructure.models.ClassStructure
8-
import kotlinx.coroutines.Dispatchers
9-
import kotlinx.coroutines.asExecutor
10-
import kotlinx.coroutines.currentCoroutineContext
11-
import kotlinx.coroutines.delay
12-
import kotlinx.coroutines.ensureActive
8+
import ee.carlrobert.codegpt.util.coroutines.runCatchingCancellable
9+
import kotlinx.coroutines.*
1310
import org.jetbrains.kotlin.psi.KtFile
14-
import kotlin.coroutines.cancellation.CancellationException
1511

1612
class PsiStructureProvider {
1713

@@ -26,7 +22,7 @@ class PsiStructureProvider {
2622

2723
while (result == null && attempts < maxAttempts) {
2824
attempts++
29-
try {
25+
runCatchingCancellable {
3026
val project = psiFiles
3127
.map { it.project }
3228
.firstOrNull { !it.isDisposed } ?: error("Project not available")
@@ -60,9 +56,7 @@ class PsiStructureProvider {
6056
.submit(Dispatchers.Default.asExecutor())
6157

6258
result = future.await()
63-
} catch (e: CancellationException) {
64-
throw e
65-
} catch (_: Exception) {
59+
}.onFailure {
6660
delay(DELAY_RESTART_READ_ACTION)
6761
}
6862
}

0 commit comments

Comments
 (0)