KT-25732 Perform keywords completion earlier to complete them before freeze
- If you complete keywords too late, the completion list may become frozen, and `null` will never make it to the top of it - Remove `flushToResultSet` between `addReferenceVariantElements` calls because flush already happens inside of them - ^KT-25732 Fixed
This commit is contained in:
committed by
Roman Golyshev
parent
36ca280b86
commit
633005fb57
+2
-4
@@ -237,6 +237,8 @@ class BasicCompletionSession(
|
||||
).completeDslFunctions()
|
||||
}
|
||||
|
||||
KEYWORDS_ONLY.doComplete()
|
||||
|
||||
val contextVariableTypesForSmartCompletion = withCollectRequiredContextVariableTypes(::completeWithSmartCompletion)
|
||||
|
||||
val contextVariableTypesForReferenceVariants = withCollectRequiredContextVariableTypes { lookupElementFactory ->
|
||||
@@ -249,21 +251,17 @@ class BasicCompletionSession(
|
||||
|
||||
prefix[0].isLowerCase() -> {
|
||||
addReferenceVariantElements(lookupElementFactory, USUALLY_START_LOWER_CASE.intersect(descriptorKindFilter))
|
||||
flushToResultSet()
|
||||
addReferenceVariantElements(lookupElementFactory, USUALLY_START_UPPER_CASE.intersect(descriptorKindFilter))
|
||||
}
|
||||
|
||||
else -> {
|
||||
addReferenceVariantElements(lookupElementFactory, USUALLY_START_UPPER_CASE.intersect(descriptorKindFilter))
|
||||
flushToResultSet()
|
||||
addReferenceVariantElements(lookupElementFactory, USUALLY_START_LOWER_CASE.intersect(descriptorKindFilter))
|
||||
}
|
||||
}
|
||||
referenceVariantsCollector!!.collectingFinished()
|
||||
}
|
||||
|
||||
KEYWORDS_ONLY.doComplete()
|
||||
|
||||
// getting root packages from scope is very slow so we do this in alternative way
|
||||
if (callTypeAndReceiver.receiver == null && callTypeAndReceiver.callType.descriptorKindFilter.kindMask.and(DescriptorKindFilter.PACKAGES_MASK) != 0) {
|
||||
//TODO: move this code somewhere else?
|
||||
|
||||
Reference in New Issue
Block a user