Dropped redundant code which was required for lambda signature completion when the syntax was different
#KT-12033 Fixed
This commit is contained in:
+5
-12
@@ -180,19 +180,12 @@ class KotlinCompletionContributor : CompletionContributor() {
|
||||
|
||||
val lambda = leaf?.parents?.firstOrNull { it is KtFunctionLiteral } ?: return null
|
||||
|
||||
val lambdaChild = leaf!!.parents.takeWhile { it != lambda }.lastOrNull() ?: return null
|
||||
if (lambdaChild is KtParameterList) return CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED
|
||||
val lambdaChild = leaf!!.parents.takeWhile { it != lambda }.lastOrNull()
|
||||
|
||||
if (lambdaChild !is KtBlockExpression) return null
|
||||
val blockChild = leaf.parents.takeWhile { it != lambdaChild }.lastOrNull()
|
||||
if (blockChild !is PsiErrorElement) return null
|
||||
val inIncompleteSignature = blockChild.siblings(forward = false, withItself = false).all {
|
||||
when (it) {
|
||||
is PsiWhiteSpace, is PsiComment -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
return if (inIncompleteSignature) CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED + "->" else null
|
||||
return if (lambdaChild is KtParameterList)
|
||||
CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED
|
||||
else
|
||||
null
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fun main(foo: Foo) {
|
||||
foo.apply {
|
||||
is<caret>
|
||||
}
|
||||
}
|
||||
class Foo(val isValid: String)
|
||||
|
||||
// EXIST: isValid
|
||||
+6
@@ -469,6 +469,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("KT12033.kt")
|
||||
public void testKT12033() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/KT12033.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("LocalMultideclarationValues.kt")
|
||||
public void testLocalMultideclarationValues() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/LocalMultideclarationValues.kt");
|
||||
|
||||
+6
@@ -469,6 +469,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("KT12033.kt")
|
||||
public void testKT12033() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/KT12033.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("LocalMultideclarationValues.kt")
|
||||
public void testLocalMultideclarationValues() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/LocalMultideclarationValues.kt");
|
||||
|
||||
Reference in New Issue
Block a user