Added parameters and type text (grayed) to "::xxx" items in smart completion
This commit is contained in:
+3
-6
@@ -324,16 +324,13 @@ class SmartCompletion(
|
||||
if (matchedExpectedInfos.isEmpty()) return null
|
||||
|
||||
var lookupElement = lookupElementFactory.createLookupElement(descriptor, useReceiverTypes = false, parametersAndTypeGrayed = true)
|
||||
val text = "::" + (if (descriptor is ConstructorDescriptor) descriptor.getContainingDeclaration().getName() else descriptor.getName())
|
||||
lookupElement = object: LookupElementDecorator<LookupElement>(lookupElement) {
|
||||
override fun getLookupString() = text
|
||||
override fun getAllLookupStrings() = setOf(text)
|
||||
override fun getLookupString() = "::" + delegate.lookupString
|
||||
override fun getAllLookupStrings() = setOf(lookupString)
|
||||
|
||||
override fun renderElement(presentation: LookupElementPresentation) {
|
||||
super.renderElement(presentation)
|
||||
presentation.setItemText(text)
|
||||
presentation.clearTail()
|
||||
presentation.setTypeText(null)
|
||||
presentation.itemText = "::" + presentation.itemText
|
||||
}
|
||||
|
||||
override fun handleInsert(context: InsertionContext) {
|
||||
|
||||
@@ -7,7 +7,7 @@ fun bar() {
|
||||
fun f1(){}
|
||||
fun f2(i: Int){}
|
||||
|
||||
// EXIST: { lookupString:"::f1", itemText:"::f1", tailText:null, typeText:null }
|
||||
// EXIST: { lookupString: "::f1", itemText: "::f1", tailText: "() (<root>)", typeText: "Unit" }
|
||||
// ABSENT: ::f2
|
||||
// ABSENT: ::Unit
|
||||
// ABSENT: ::Nothing
|
||||
|
||||
+1
-3
@@ -64,9 +64,7 @@ public object ExpectedCompletionUtils {
|
||||
throw RuntimeException("Invalid json property '$key'")
|
||||
}
|
||||
val value = entry.value
|
||||
if (value !is JsonNull) {
|
||||
map.put(key, value.asString)
|
||||
}
|
||||
map.put(key, if (value !is JsonNull) value.asString else null)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user