Ordering items in smart completion for nullable

This commit is contained in:
Valentin Kipyatkov
2014-10-20 17:44:52 +04:00
parent 4068879d84
commit f5f5b514d4
3 changed files with 22 additions and 1 deletions
@@ -56,6 +56,6 @@ object KeywordValues {
collection.addLookupElements(expectedInfos,
{ info -> if (info.type.isNullable()) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES },
{ LookupElementBuilder.create("null").bold() })
{ LookupElementBuilder.create("null").bold().assignSmartCompletionPriority(SmartCompletionItemPriority.NULL) })
}
}
@@ -209,6 +209,7 @@ enum class SmartCompletionItemPriority {
LAMBDA_NO_PARAMS
LAMBDA
FUNCTION_REFERENCE
NULL
}
val SMART_COMPLETION_ITEM_PRIORITY_KEY = Key<SmartCompletionItemPriority>("SMART_COMPLETION_ITEM_PRIORITY_KEY")
@@ -0,0 +1,20 @@
var global: C = C()
abstract class C {
class object {
val INSTANCE = C()
}
}
fun foo(p: C?) {
val local = C()
foo(<caret>)
}
// ORDER: p
// ORDER: local
// ORDER: global
// ORDER: C.INSTANCE
// ORDER: object
// ORDER: null