KT-4000 Class name completion is not available inside call expressions
#KT-4000 Fixed
This commit is contained in:
@@ -207,20 +207,9 @@ public class CompletionSession {
|
||||
PsiElement element = getPosition();
|
||||
if (getPosition().getNode().getElementType() == JetTokens.IDENTIFIER) {
|
||||
if (element.getParent() instanceof JetSimpleNameExpression) {
|
||||
JetSimpleNameExpression nameExpression = (JetSimpleNameExpression)element.getParent();
|
||||
|
||||
// Top level completion should be executed for simple name which is not in qualified expression
|
||||
if (PsiTreeUtil.getParentOfType(nameExpression, JetQualifiedExpression.class) != null) {
|
||||
return false;
|
||||
if (!JetPsiUtil.isSelectorInQualified((JetSimpleNameExpression) element.getParent())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Don't call top level completion in qualified named position of user type
|
||||
PsiElement parent = nameExpression.getParent();
|
||||
if (parent instanceof JetUserType && ((JetUserType) parent).getQualifier() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
fun foo(a: Collection<String>) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val t = Test()
|
||||
t.foo(Array<caret>)
|
||||
}
|
||||
|
||||
// EXIST: ArrayList
|
||||
// INVOCATION_COUNT: 2
|
||||
@@ -354,6 +354,11 @@ public class JetBasicJSCompletionTestGenerated extends AbstractJetJSCompletionTe
|
||||
doTest("idea/testData/completion/basic/common/SubpackageInFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelClassCompletionInQualifiedCall.kt")
|
||||
public void testTopLevelClassCompletionInQualifiedCall() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/TopLevelClassCompletionInQualifiedCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VariableClassName.kt")
|
||||
public void testVariableClassName() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/VariableClassName.kt");
|
||||
|
||||
@@ -354,6 +354,11 @@ public class JetBasicJavaCompletionTestGenerated extends AbstractJavaCompletionT
|
||||
doTest("idea/testData/completion/basic/common/SubpackageInFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelClassCompletionInQualifiedCall.kt")
|
||||
public void testTopLevelClassCompletionInQualifiedCall() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/TopLevelClassCompletionInQualifiedCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VariableClassName.kt")
|
||||
public void testVariableClassName() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/VariableClassName.kt");
|
||||
|
||||
Reference in New Issue
Block a user