SAM-adapters are sorted as non-extensions in completion and with correct boldness + no parameter names when from compiled
This commit is contained in:
+5
-3
@@ -255,8 +255,7 @@ public class LookupElementFactory(
|
||||
}
|
||||
|
||||
if (descriptor is CallableDescriptor) {
|
||||
val original = descriptor.original
|
||||
val extensionReceiver = original.extensionReceiverParameter
|
||||
val extensionReceiver = descriptor.original.extensionReceiverParameter
|
||||
when {
|
||||
descriptor is SyntheticJavaPropertyDescriptor -> {
|
||||
var from = descriptor.getMethod.getName().asString() + "()"
|
||||
@@ -265,7 +264,7 @@ public class LookupElementFactory(
|
||||
}
|
||||
|
||||
// no need to show them as extensions
|
||||
original is SamAdapterExtensionFunctionDescriptor -> {}
|
||||
descriptor is SamAdapterExtensionFunctionDescriptor -> {}
|
||||
|
||||
extensionReceiver != null -> {
|
||||
val receiverPresentation = DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(extensionReceiver.type)
|
||||
@@ -336,6 +335,9 @@ public class LookupElementFactory(
|
||||
if (descriptor is SyntheticJavaPropertyDescriptor) {
|
||||
return callableWeight(descriptor.getMethod)
|
||||
}
|
||||
if (descriptor is SamAdapterExtensionFunctionDescriptor) {
|
||||
return callableWeight(descriptor.sourceFunction)
|
||||
}
|
||||
|
||||
val receiverParameter = descriptor.extensionReceiverParameter ?: descriptor.dispatchReceiverParameter
|
||||
if (receiverParameter != null) {
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import lib.JavaClass
|
||||
|
||||
fun test() = JavaClass().<caret>
|
||||
|
||||
// EXIST: { lookupString: "execute", itemText: "execute", tailText: "(Runnable!)", typeText: "Unit" }
|
||||
// EXIST: { lookupString: "execute", itemText: "execute", tailText: " {...} ((() -> Unit)!)", typeText: "Unit" }
|
||||
@@ -1,5 +0,0 @@
|
||||
package lib;
|
||||
|
||||
public class JavaClass {
|
||||
public void execute(Runnable runnable) {}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import lib.JavaClass
|
||||
|
||||
class KotlinClass : JavaClass()
|
||||
|
||||
fun test() = KotlinClass().<caret>
|
||||
|
||||
// EXIST: { lookupString: "execute", itemText: "execute", tailText: "(Runnable!, Int)", typeText: "Unit", attributes: "" }
|
||||
// EXIST: { lookupString: "execute", itemText: "execute", tailText: "((() -> Unit)!, Int)", typeText: "Unit", attributes: "" }
|
||||
@@ -0,0 +1,8 @@
|
||||
import lib.*;
|
||||
|
||||
fun foo(j: JavaInterface<String>) {
|
||||
j.<caret>
|
||||
}
|
||||
|
||||
// EXIST: { lookupString: "execute", itemText: "execute", tailText: "(Task<String!>!, K!)", typeText: "String!", attributes: "bold" }
|
||||
// EXIST: { lookupString: "execute", itemText: "execute", tailText: "(((String!) -> Unit)!, K!)", typeText: "String!", attributes: "bold" }
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package lib;
|
||||
|
||||
public interface JavaInterface<T> {
|
||||
<K> T execute(Task<T> task, K k);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package lib;
|
||||
|
||||
public interface Task<T> {
|
||||
void run(T t);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package lib;
|
||||
|
||||
public class JavaClass {
|
||||
public void execute(Runnable runnable, int x) {}
|
||||
}
|
||||
+9
-3
@@ -47,9 +47,15 @@ public class JvmWithLibBasicCompletionTestGenerated extends AbstractJvmWithLibBa
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SAMAdapters.kt")
|
||||
public void testSAMAdapters() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/custom/SAMAdapters.kt");
|
||||
@TestMetadata("SamAdapter.kt")
|
||||
public void testSamAdapter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/custom/SamAdapter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SamAdapterAndGenerics.kt")
|
||||
public void testSamAdapterAndGenerics() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/custom/SamAdapterAndGenerics.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user