Add checkCanceled check on resolving imports path
Imports resolution is a rather time consuming task and doesn't have `checkCanceled` on its computation path. So, if a thread is resolving imports it will do it until the end of computation, which can lead to unnecessary work and some IDE freezes. #KT-34990 Fixed
This commit is contained in:
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.codeFragmentUtil.suppressDiagnosticsInDebugMode
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getTopmostParentQualifiedExpressionForSelector
|
||||
@@ -220,6 +221,8 @@ class QualifiedExpressionResolver(val languageVersionSettings: LanguageVersionSe
|
||||
excludedImportNames: Collection<FqName>,
|
||||
packageFragmentForVisibilityCheck: PackageFragmentDescriptor?
|
||||
): ImportingScope? { // null if some error happened
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
|
||||
val importedReference = importDirective.importContent ?: return null
|
||||
val path = importedReference.asQualifierPartList()
|
||||
val lastPart = path.lastOrNull() ?: return null
|
||||
|
||||
Reference in New Issue
Block a user