Ordering items in smart completion for boolean

This commit is contained in:
Valentin Kipyatkov
2014-10-20 17:38:23 +04:00
parent 9cf50154d2
commit 4068879d84
3 changed files with 25 additions and 2 deletions
@@ -50,8 +50,8 @@ object KeywordValues {
val booleanInfoClassifier = { (info: ExpectedInfo) ->
if (info.type == KotlinBuiltIns.getInstance().getBooleanType()) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES
}
collection.addLookupElements(expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("true").bold() })
collection.addLookupElements(expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("false").bold() })
collection.addLookupElements(expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("true").bold().assignSmartCompletionPriority(SmartCompletionItemPriority.TRUE) })
collection.addLookupElements(expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("false").bold().assignSmartCompletionPriority(SmartCompletionItemPriority.FALSE) })
}
collection.addLookupElements(expectedInfos,
@@ -198,6 +198,8 @@ fun String?.isNullOrEmpty() = this == null || this.isEmpty()
enum class SmartCompletionItemPriority {
/*IT*/ //TODO
TRUE
FALSE
THIS
DEFAULT
NULLABLE
@@ -0,0 +1,21 @@
var nonNullable: Boolean = true
var nullableX: Boolean? = null
var nullableFoo: Boolean? = null
fun foo(pFoo: Boolean, s: String) {
val local = true
foo(<caret>)
}
// ORDER: "pFoo, s"
// ORDER: pFoo
// ORDER: nullableFoo
// ORDER: nullableFoo
// ORDER: true
// ORDER: false
// ORDER: local
// ORDER: ASSERTIONS_ENABLED
// ORDER: nonNullable
// ORDER: nullableX
// ORDER: nullableX