Code completion: added type parameters for Kotlin classes too
This commit is contained in:
@@ -81,6 +81,11 @@ public open class LookupElementFactory protected() {
|
||||
}
|
||||
|
||||
is ClassDescriptor -> {
|
||||
val typeParams = descriptor.getTypeConstructor().getParameters()
|
||||
if (typeParams.isNotEmpty()) {
|
||||
element = element.appendTailText("<" + typeParams.map { it.getName().asString() }.joinToString(", ") + ">", true)
|
||||
}
|
||||
|
||||
element = element.appendTailText(" (" + DescriptorUtils.getFqName(descriptor.getContainingDeclaration()) + ")", true)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class Generic1<T>
|
||||
|
||||
class Generic2<T1, T2>
|
||||
|
||||
fun foo(): G<caret>
|
||||
|
||||
// EXIST: { lookupString: "Generic1", itemText: "Generic1", tailText: "<T> (<root>)" }
|
||||
// EXIST: { lookupString: "Generic2", itemText: "Generic2", tailText: "<T1, T2> (<root>)" }
|
||||
@@ -4,10 +4,9 @@ fun main(args: Array<String>) {
|
||||
|
||||
// INVOCATION_COUNT: 2
|
||||
// WITH_ORDER: 1
|
||||
// EXIST: { lookupString:"Array", tailText:" (kotlin)" }
|
||||
// EXIST: { lookupString:"Array", tailText:"<T> (kotlin)" }
|
||||
// EXIST_JAVA_ONLY: { lookupString:"Array", tailText:" (java.sql)" }
|
||||
// EXIST_JAVA_ONLY: { lookupString:"ArrayList", tailText:"<E> (java.util)" }
|
||||
// EXIST_JS_ONLY: { lookupString:"ArrayList", tailText:" (java.util)" }
|
||||
// EXIST: { lookupString:"ArrayList", tailText:"<E> (java.util)" }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -292,6 +292,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("GenericKotlinClass.kt")
|
||||
public void testGenericKotlinClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/GenericKotlinClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("HigherOrderFunction1.kt")
|
||||
public void testHigherOrderFunction1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/HigherOrderFunction1.kt");
|
||||
|
||||
@@ -292,6 +292,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("GenericKotlinClass.kt")
|
||||
public void testGenericKotlinClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/GenericKotlinClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("HigherOrderFunction1.kt")
|
||||
public void testHigherOrderFunction1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/HigherOrderFunction1.kt");
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.jet.completion;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user