Render flexible types with enhancement as enhanced in IDE (KT-25622)
Main targets for the fix is completion, parameters info, inlay hints and override/implement. Other IDE functions might be affected. #KT-24911 Fixed #KT-25616 Fixed #KT-25622 Fixed
This commit is contained in:
+5
-1
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.idea.completion.handlers.KotlinFunctionInsertHandler
|
||||
import org.jetbrains.kotlin.idea.core.completion.DeclarationLookupObject
|
||||
import org.jetbrains.kotlin.idea.core.completion.PackageLookupObject
|
||||
import org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -50,7 +51,10 @@ class BasicLookupElementFactory(
|
||||
) {
|
||||
companion object {
|
||||
// we skip parameter names in functional types in most of cases for shortness
|
||||
val SHORT_NAMES_RENDERER = DescriptorRenderer.SHORT_NAMES_IN_TYPES.withOptions { parameterNamesInFunctionalTypes = false }
|
||||
val SHORT_NAMES_RENDERER = DescriptorRenderer.SHORT_NAMES_IN_TYPES.withOptions {
|
||||
enhancedTypes = true
|
||||
parameterNamesInFunctionalTypes = false
|
||||
}
|
||||
}
|
||||
|
||||
fun createLookupElement(
|
||||
|
||||
idea/idea-completion/testData/basic/multifile/EnhancementFlexibleTypes/EnhancementFlexibleTypes.java
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
import androidx.annotation.RecentlyNonNull;
|
||||
import androidx.annotation.RecentlyNullable;
|
||||
|
||||
public class EnhancementFlexibleTypes {
|
||||
public static void testNullable(@RecentlyNullable String string) {
|
||||
|
||||
}
|
||||
|
||||
public static void testNotNull(@RecentlyNonNull String string) {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
fun temp() {
|
||||
EnhancementFlexibleTypes.test<caret>
|
||||
}
|
||||
|
||||
// EXIST: { lookupString: "testNotNull", tailText:"(string: String)" }
|
||||
// EXIST: { lookupString: "testNullable", tailText:"(string: String?)" }
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package androidx.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.TYPE})
|
||||
public @interface RecentlyNonNull {
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
package androidx.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.reflect.Parameter;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.TYPE})
|
||||
public @interface RecentlyNullable {
|
||||
}
|
||||
+5
@@ -74,6 +74,11 @@ public class MultiFileJvmBasicCompletionTestGenerated extends AbstractMultiFileJ
|
||||
runTest("idea/idea-completion/testData/basic/multifile/DoNotCompleteWithConstraints/");
|
||||
}
|
||||
|
||||
@TestMetadata("EnhancementFlexibleTypes")
|
||||
public void testEnhancementFlexibleTypes() throws Exception {
|
||||
runTest("idea/idea-completion/testData/basic/multifile/EnhancementFlexibleTypes/");
|
||||
}
|
||||
|
||||
@TestMetadata("EntriesOfNotImportedEnumFromKotlin")
|
||||
public void testEntriesOfNotImportedEnumFromKotlin() throws Exception {
|
||||
runTest("idea/idea-completion/testData/basic/multifile/EntriesOfNotImportedEnumFromKotlin/");
|
||||
|
||||
Reference in New Issue
Block a user