Better presentation of aliases in completion list
This commit is contained in:
+5
-1
@@ -169,7 +169,7 @@ class BasicLookupElementFactory(
|
|||||||
element = element.withTypeText(DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(descriptor.type), parametersAndTypeGrayed)
|
element = element.withTypeText(DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(descriptor.type), parametersAndTypeGrayed)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ClassDescriptor -> {
|
is ClassifierDescriptorWithTypeParameters -> {
|
||||||
val typeParams = descriptor.declaredTypeParameters
|
val typeParams = descriptor.declaredTypeParameters
|
||||||
if (includeClassTypeArguments && typeParams.isNotEmpty()) {
|
if (includeClassTypeArguments && typeParams.isNotEmpty()) {
|
||||||
element = element.appendTailText(typeParams.map { it.name.asString() }.joinToString(", ", "<", ">"), true)
|
element = element.appendTailText(typeParams.map { it.name.asString() }.joinToString(", ", "<", ">"), true)
|
||||||
@@ -192,6 +192,10 @@ class BasicLookupElementFactory(
|
|||||||
if (container is PackageFragmentDescriptor || container is ClassDescriptor) {
|
if (container is PackageFragmentDescriptor || container is ClassDescriptor) {
|
||||||
element = element.appendTailText(" (" + DescriptorUtils.getFqName(container) + ")", true)
|
element = element.appendTailText(" (" + DescriptorUtils.getFqName(container) + ")", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (descriptor is TypeAliasDescriptor) {
|
||||||
|
element = element.withTypeText(DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(descriptor.underlyingType), false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ fun some(e: IllegalArgumentException<caret>) {
|
|||||||
|
|
||||||
// INVOCATION_COUNT: 2
|
// INVOCATION_COUNT: 2
|
||||||
// WITH_ORDER
|
// WITH_ORDER
|
||||||
// EXIST: { lookupString:"IllegalArgumentException", typeText:"public typealias IllegalArgumentException = IllegalArgumentException defined in kotlin" }
|
// EXIST: { lookupString:"IllegalArgumentException", tailText: " (kotlin)", typeText:"IllegalArgumentException" }
|
||||||
// EXIST: { lookupString:"IllegalArgumentException", tailText:" (java.lang)" }
|
// EXIST: { lookupString:"IllegalArgumentException", tailText:" (java.lang)" }
|
||||||
|
|||||||
+1
-1
@@ -2,4 +2,4 @@ package test2
|
|||||||
|
|
||||||
fun foo(ali<caret>)
|
fun foo(ali<caret>)
|
||||||
|
|
||||||
// EXIST: { lookupString: "alias : MyAlias", itemText: "alias: MyAlias", typeText: "public typealias MyAlias = MyClass defined in test", attributes: "" }
|
// EXIST: { lookupString: "alias : MyAlias", itemText: "alias: MyAlias", tailText: " (test)", typeText: "MyClass", attributes: "" }
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ private typealias MyPrivateAlias = (String, Char) -> Unit
|
|||||||
|
|
||||||
val test: My<caret>
|
val test: My<caret>
|
||||||
|
|
||||||
// EXIST: { lookupString: "MySameFileAlias", itemText: "MySameFileAlias", tailText: null, typeText: "public typealias MySameFileAlias = (String) -> Int defined in test", attributes: "" }
|
// EXIST: { lookupString: "MySameFileAlias", itemText: "MySameFileAlias", tailText: " (test)", typeText: "(String) -> Int", attributes: "" }
|
||||||
// EXIST: { lookupString: "MyPrivateAlias", itemText: "MyPrivateAlias", tailText: null, typeText: "private typealias MyPrivateAlias = (String, Char) -> Unit defined in test", attributes: "" }
|
// EXIST: { lookupString: "MyPrivateAlias", itemText: "MyPrivateAlias", tailText: " (test)", typeText: "(String, Char) -> Unit", attributes: "" }
|
||||||
// EXIST: { lookupString: "MyAlias", itemText: "MyAlias", tailText: null, typeText: "public typealias MyAlias = MyClass defined in dependency", attributes: "" }
|
// EXIST: { lookupString: "MyAlias", itemText: "MyAlias", tailText: " (dependency)", typeText: "MyClass", attributes: "" }
|
||||||
|
|||||||
Reference in New Issue
Block a user