[FIR IDE] Rethrow IndexNotReadyException from KtFirReferenceResolver
Resolve can be called even when the indices are not ready. In such cases the `IndexNotReadyException` can be intentionally ignored by the platform code To make our code play nice with the platform, from now on we do not wrap `IndexNotReadyException` into another exception - instead we just let it fly and be ignored by the platform. If the platform doesn't choose to ignore it, then it will be showed as an error as usual
This commit is contained in:
+3
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.idea.references
|
||||
|
||||
import com.intellij.openapi.diagnostic.ControlFlowException
|
||||
import com.intellij.openapi.project.IndexNotReadyException
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementResolveResult
|
||||
import com.intellij.psi.ResolveResult
|
||||
@@ -26,7 +27,8 @@ object KtFirReferenceResolver : ResolveCache.PolyVariantResolver<KtReference> {
|
||||
val resolveToPsiElements = try {
|
||||
analyse(ref.expression) { ref.getResolvedToPsi(this) }
|
||||
} catch (e: Throwable) {
|
||||
if (e is ControlFlowException) throw e
|
||||
if (e is ControlFlowException || e is IndexNotReadyException) throw e
|
||||
|
||||
throw KtReferenceResolveException(ref, e)
|
||||
}
|
||||
resolveToPsiElements.map { KotlinResolveResult(it) }.toTypedArray()
|
||||
|
||||
Reference in New Issue
Block a user