diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/KeywordValues.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/KeywordValues.kt index ee2b057a30a..7f442244662 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/KeywordValues.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/KeywordValues.kt @@ -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, diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/Utils.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/Utils.kt index 8045c49950b..49b753dbdec 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/Utils.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/Utils.kt @@ -198,6 +198,8 @@ fun String?.isNullOrEmpty() = this == null || this.isEmpty() enum class SmartCompletionItemPriority { /*IT*/ //TODO + TRUE + FALSE THIS DEFAULT NULLABLE diff --git a/idea/testData/completion/weighers/smart/BooleanExpected.kt b/idea/testData/completion/weighers/smart/BooleanExpected.kt new file mode 100644 index 00000000000..e3191c2a490 --- /dev/null +++ b/idea/testData/completion/weighers/smart/BooleanExpected.kt @@ -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() +} + +// ORDER: "pFoo, s" +// ORDER: pFoo +// ORDER: nullableFoo +// ORDER: nullableFoo +// ORDER: true +// ORDER: false +// ORDER: local +// ORDER: ASSERTIONS_ENABLED +// ORDER: nonNullable +// ORDER: nullableX +// ORDER: nullableX