Added parameters and type text (grayed) to "::xxx" items in smart completion

This commit is contained in:
Valentin Kipyatkov
2015-10-01 22:33:43 +03:00
parent 58bcb576a1
commit f58f5dd82a
3 changed files with 5 additions and 10 deletions
@@ -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
@@ -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)
}
}