diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt index f889abbb75c..e9dac9efb78 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt @@ -287,7 +287,7 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration, match.isMatch() } if (matched) { - lookupElement.putUserData(SmartCompletionInBasicWeigher.KEYWORD_VALUE_MATCHED_KEY, matched) + lookupElement.putUserData(SmartCompletionInBasicWeigher.KEYWORD_VALUE_MATCHED_KEY, Unit) lookupElement.putUserData(SMART_COMPLETION_ITEM_PRIORITY_KEY, priority) } collector.addElement(lookupElement) diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/Weighers.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/Weighers.kt index 8b125378db1..857a86223bb 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/Weighers.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/Weighers.kt @@ -184,7 +184,7 @@ class SmartCompletionInBasicWeigher( ) : LookupElementWeigher("kotlin.smartInBasic", true, false) { companion object { - val KEYWORD_VALUE_MATCHED_KEY = Key("SmartCompletionInBasicWeigher.KEYWORD_VALUE_MATCHED_KEY") + val KEYWORD_VALUE_MATCHED_KEY = Key("SmartCompletionInBasicWeigher.KEYWORD_VALUE_MATCHED_KEY") } private val descriptorsToSkip = smartCompletion.descriptorsToSkip @@ -201,14 +201,11 @@ class SmartCompletionInBasicWeigher( private val DESCRIPTOR_TO_SKIP_WEIGHT = -1L // if descriptor is skipped from smart completion then it's probably irrelevant override fun weigh(element: LookupElement): Long { - val keywordValueMatched = element.getUserData(KEYWORD_VALUE_MATCHED_KEY) - val smartCompletionPriority = element.getUserData(SMART_COMPLETION_ITEM_PRIORITY_KEY) - - if (keywordValueMatched != null) { - return if (keywordValueMatched) fullMatchWeight(0) else NO_MATCH_WEIGHT + if (element.getUserData(KEYWORD_VALUE_MATCHED_KEY) != null) { + return fullMatchWeight(0) } - if (smartCompletionPriority != null) { // it's an "additional item" came from smart completion, don't match it against expected type + if (element.getUserData(SMART_COMPLETION_ITEM_PRIORITY_KEY) != null) { // it's an "additional item" came from smart completion, don't match it against expected type return smartCompletionItemWeight(element.getUserData(NAME_SIMILARITY_KEY) ?: 0) }