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
|
if (matchedExpectedInfos.isEmpty()) return null
|
||||||
|
|
||||||
var lookupElement = lookupElementFactory.createLookupElement(descriptor, useReceiverTypes = false, parametersAndTypeGrayed = true)
|
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) {
|
lookupElement = object: LookupElementDecorator<LookupElement>(lookupElement) {
|
||||||
override fun getLookupString() = text
|
override fun getLookupString() = "::" + delegate.lookupString
|
||||||
override fun getAllLookupStrings() = setOf(text)
|
override fun getAllLookupStrings() = setOf(lookupString)
|
||||||
|
|
||||||
override fun renderElement(presentation: LookupElementPresentation) {
|
override fun renderElement(presentation: LookupElementPresentation) {
|
||||||
super.renderElement(presentation)
|
super.renderElement(presentation)
|
||||||
presentation.setItemText(text)
|
presentation.itemText = "::" + presentation.itemText
|
||||||
presentation.clearTail()
|
|
||||||
presentation.setTypeText(null)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleInsert(context: InsertionContext) {
|
override fun handleInsert(context: InsertionContext) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ fun bar() {
|
|||||||
fun f1(){}
|
fun f1(){}
|
||||||
fun f2(i: Int){}
|
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: ::f2
|
||||||
// ABSENT: ::Unit
|
// ABSENT: ::Unit
|
||||||
// ABSENT: ::Nothing
|
// ABSENT: ::Nothing
|
||||||
|
|||||||
+1
-3
@@ -64,9 +64,7 @@ public object ExpectedCompletionUtils {
|
|||||||
throw RuntimeException("Invalid json property '$key'")
|
throw RuntimeException("Invalid json property '$key'")
|
||||||
}
|
}
|
||||||
val value = entry.value
|
val value = entry.value
|
||||||
if (value !is JsonNull) {
|
map.put(key, if (value !is JsonNull) value.asString else null)
|
||||||
map.put(key, value.asString)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user