KT-8843 When typing in lambda parameters' names, smart completion kicks in and makes it impossible to type names
#KT-8843 Fixed
This commit is contained in:
+8
-10
@@ -145,17 +145,15 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
|
||||
}
|
||||
|
||||
private fun shouldCompleteParameterNameAndType(): Boolean {
|
||||
when (completionKind) {
|
||||
CompletionKind.PARAMETER_NAME, CompletionKind.ANNOTATION_TYPES_OR_PARAMETER_NAME -> {
|
||||
val parameter = position.getNonStrictParentOfType<JetParameter>()!!
|
||||
val list = parameter.getParent() as? JetParameterList ?: return false
|
||||
val owner = list.getParent()
|
||||
return owner !is JetCatchClause &&
|
||||
owner !is JetPropertyAccessor &&
|
||||
!((owner as? JetPrimaryConstructor)?.getContainingClassOrObject()?.isAnnotation() ?: false)
|
||||
}
|
||||
if (completionKind != CompletionKind.PARAMETER_NAME && completionKind != CompletionKind.ANNOTATION_TYPES_OR_PARAMETER_NAME) return false
|
||||
|
||||
else -> return false
|
||||
val parameter = position.getNonStrictParentOfType<JetParameter>()!!
|
||||
val list = parameter.parent as? JetParameterList ?: return false
|
||||
val owner = list.parent
|
||||
return when (owner) {
|
||||
is JetCatchClause, is JetPropertyAccessor, is JetFunctionLiteral -> false
|
||||
is JetPrimaryConstructor -> !owner.getContainingClassOrObject().isAnnotation()
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class AAA
|
||||
|
||||
fun foo(p: (Int, String) -> Unit) { }
|
||||
|
||||
fun bar() {
|
||||
foo { a<caret>, b -> }
|
||||
}
|
||||
|
||||
// NUMBER: 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class BBB
|
||||
|
||||
fun foo(p: (Int, String) -> Unit) { }
|
||||
|
||||
fun bar() {
|
||||
foo { a, b<caret> }
|
||||
}
|
||||
|
||||
// NUMBER: 0
|
||||
+15
-3
@@ -1584,9 +1584,21 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotForLambdaParameter.kt")
|
||||
public void testNotForLambdaParameter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForLambdaParameter.kt");
|
||||
@TestMetadata("NotForLambdaParameter1.kt")
|
||||
public void testNotForLambdaParameter1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForLambdaParameter1.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotForLambdaParameter2.kt")
|
||||
public void testNotForLambdaParameter2() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForLambdaParameter2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotForLambdaParameter3.kt")
|
||||
public void testNotForLambdaParameter3() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForLambdaParameter3.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
|
||||
+15
-3
@@ -1584,9 +1584,21 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotForLambdaParameter.kt")
|
||||
public void testNotForLambdaParameter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForLambdaParameter.kt");
|
||||
@TestMetadata("NotForLambdaParameter1.kt")
|
||||
public void testNotForLambdaParameter1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForLambdaParameter1.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotForLambdaParameter2.kt")
|
||||
public void testNotForLambdaParameter2() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForLambdaParameter2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotForLambdaParameter3.kt")
|
||||
public void testNotForLambdaParameter3() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForLambdaParameter3.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user