Use non-blocking lazy values in completion
This commit is contained in:
@@ -179,7 +179,7 @@ abstract class CompletionSession(protected val configuration: CompletionSessionC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LookupElementsCollector instantiation is deferred because virtual call to createSorter uses data from derived classes
|
// LookupElementsCollector instantiation is deferred because virtual call to createSorter uses data from derived classes
|
||||||
protected val collector: LookupElementsCollector by lazy {
|
protected val collector: LookupElementsCollector by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
LookupElementsCollector(prefixMatcher, parameters, resultSet, lookupElementFactory, createSorter())
|
LookupElementsCollector(prefixMatcher, parameters, resultSet, lookupElementFactory, createSorter())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ abstract class CompletionSession(protected val configuration: CompletionSessionC
|
|||||||
return context
|
return context
|
||||||
}
|
}
|
||||||
|
|
||||||
protected val referenceVariants: Collection<DeclarationDescriptor> by lazy {
|
protected val referenceVariants: Collection<DeclarationDescriptor> by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
if (descriptorKindFilter != null) {
|
if (descriptorKindFilter != null) {
|
||||||
referenceVariantsHelper.getReferenceVariants(
|
referenceVariantsHelper.getReferenceVariants(
|
||||||
nameExpression!!,
|
nameExpression!!,
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.types.JetType
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class InsertHandlerProvider(expectedInfosCalculator: () -> Collection<ExpectedInfo>) {
|
class InsertHandlerProvider(expectedInfosCalculator: () -> Collection<ExpectedInfo>) {
|
||||||
private val expectedInfos by lazy { expectedInfosCalculator() }
|
private val expectedInfos by lazy(LazyThreadSafetyMode.NONE) { expectedInfosCalculator() }
|
||||||
|
|
||||||
public fun insertHandler(descriptor: DeclarationDescriptor): InsertHandler<LookupElement> {
|
public fun insertHandler(descriptor: DeclarationDescriptor): InsertHandler<LookupElement> {
|
||||||
return when (descriptor) {
|
return when (descriptor) {
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ class LookupElementFactory(
|
|||||||
) {
|
) {
|
||||||
private val basicFactory = BasicLookupElementFactory(resolutionFacade.project, insertHandlerProvider)
|
private val basicFactory = BasicLookupElementFactory(resolutionFacade.project, insertHandlerProvider)
|
||||||
|
|
||||||
private val functionTypeContextVariables by lazy {
|
private val functionTypeContextVariables by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
contextVariablesProvider().filter { KotlinBuiltIns.isFunctionOrExtensionFunctionType(it.type) }
|
contextVariablesProvider().filter { KotlinBuiltIns.isFunctionOrExtensionFunctionType(it.type) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -64,7 +64,7 @@ class SmartCompletion(
|
|||||||
|
|
||||||
public val expectedInfos: Collection<ExpectedInfo> = calcExpectedInfos(expressionWithType)
|
public val expectedInfos: Collection<ExpectedInfo> = calcExpectedInfos(expressionWithType)
|
||||||
|
|
||||||
public val smartCastCalculator: SmartCastCalculator by lazy {
|
public val smartCastCalculator: SmartCastCalculator by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
SmartCastCalculator(bindingContext, resolutionFacade.moduleDescriptor, expression)
|
SmartCastCalculator(bindingContext, resolutionFacade.moduleDescriptor, expression)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ class SmartCompletion(
|
|||||||
return postProcessedItems to postProcessedSearcher
|
return postProcessedItems to postProcessedSearcher
|
||||||
}
|
}
|
||||||
|
|
||||||
public val descriptorsToSkip: Set<DeclarationDescriptor> by lazy<Set<DeclarationDescriptor>> {
|
public val descriptorsToSkip: Set<DeclarationDescriptor> by lazy<Set<DeclarationDescriptor>>(LazyThreadSafetyMode.NONE) {
|
||||||
val parent = expressionWithType.getParent()
|
val parent = expressionWithType.getParent()
|
||||||
when (parent) {
|
when (parent) {
|
||||||
is JetBinaryExpression -> {
|
is JetBinaryExpression -> {
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ class SmartCompletionSession(configuration: CompletionSessionConfiguration, para
|
|||||||
// we do not include SAM-constructors because they are handled separately and adding them requires iterating of java classes
|
// we do not include SAM-constructors because they are handled separately and adding them requires iterating of java classes
|
||||||
override val descriptorKindFilter = DescriptorKindFilter.VALUES exclude SamConstructorDescriptorKindExclude
|
override val descriptorKindFilter = DescriptorKindFilter.VALUES exclude SamConstructorDescriptorKindExclude
|
||||||
|
|
||||||
private val smartCompletion by lazy {
|
private val smartCompletion by lazy(LazyThreadSafetyMode.NONE) {
|
||||||
expression?.let {
|
expression?.let {
|
||||||
SmartCompletion(it, resolutionFacade,
|
SmartCompletion(it, resolutionFacade,
|
||||||
bindingContext, isVisibleFilter, prefixMatcher, originalSearchScope,
|
bindingContext, isVisibleFilter, prefixMatcher, originalSearchScope,
|
||||||
|
|||||||
Reference in New Issue
Block a user