Ordering items in smart completion for boolean
This commit is contained in:
@@ -50,8 +50,8 @@ object KeywordValues {
|
|||||||
val booleanInfoClassifier = { (info: ExpectedInfo) ->
|
val booleanInfoClassifier = { (info: ExpectedInfo) ->
|
||||||
if (info.type == KotlinBuiltIns.getInstance().getBooleanType()) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES
|
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("true").bold().assignSmartCompletionPriority(SmartCompletionItemPriority.TRUE) })
|
||||||
collection.addLookupElements(expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("false").bold() })
|
collection.addLookupElements(expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("false").bold().assignSmartCompletionPriority(SmartCompletionItemPriority.FALSE) })
|
||||||
}
|
}
|
||||||
|
|
||||||
collection.addLookupElements(expectedInfos,
|
collection.addLookupElements(expectedInfos,
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ fun String?.isNullOrEmpty() = this == null || this.isEmpty()
|
|||||||
|
|
||||||
enum class SmartCompletionItemPriority {
|
enum class SmartCompletionItemPriority {
|
||||||
/*IT*/ //TODO
|
/*IT*/ //TODO
|
||||||
|
TRUE
|
||||||
|
FALSE
|
||||||
THIS
|
THIS
|
||||||
DEFAULT
|
DEFAULT
|
||||||
NULLABLE
|
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
|
||||||
Reference in New Issue
Block a user