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
|
||||
protected val collector: LookupElementsCollector by lazy {
|
||||
protected val collector: LookupElementsCollector by lazy(LazyThreadSafetyMode.NONE) {
|
||||
LookupElementsCollector(prefixMatcher, parameters, resultSet, lookupElementFactory, createSorter())
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ abstract class CompletionSession(protected val configuration: CompletionSessionC
|
||||
return context
|
||||
}
|
||||
|
||||
protected val referenceVariants: Collection<DeclarationDescriptor> by lazy {
|
||||
protected val referenceVariants: Collection<DeclarationDescriptor> by lazy(LazyThreadSafetyMode.NONE) {
|
||||
if (descriptorKindFilter != null) {
|
||||
referenceVariantsHelper.getReferenceVariants(
|
||||
nameExpression!!,
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.types.JetType
|
||||
import java.util.*
|
||||
|
||||
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> {
|
||||
return when (descriptor) {
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ class LookupElementFactory(
|
||||
) {
|
||||
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) }
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -64,7 +64,7 @@ class SmartCompletion(
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class SmartCompletion(
|
||||
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()
|
||||
when (parent) {
|
||||
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
|
||||
override val descriptorKindFilter = DescriptorKindFilter.VALUES exclude SamConstructorDescriptorKindExclude
|
||||
|
||||
private val smartCompletion by lazy {
|
||||
private val smartCompletion by lazy(LazyThreadSafetyMode.NONE) {
|
||||
expression?.let {
|
||||
SmartCompletion(it, resolutionFacade,
|
||||
bindingContext, isVisibleFilter, prefixMatcher, originalSearchScope,
|
||||
|
||||
Reference in New Issue
Block a user