Don't activate top level completion in user types after dot

This commit is contained in:
Nikolay Krasko
2012-09-20 15:44:06 +04:00
parent f1059271b2
commit b301bbe1f9
3 changed files with 19 additions and 2 deletions
@@ -264,8 +264,18 @@ public class JetCompletionContributor extends CompletionContributor {
if (element.getParent() instanceof JetSimpleNameExpression) {
JetSimpleNameExpression nameExpression = (JetSimpleNameExpression)element.getParent();
// Top level completion should be executed for simple which is not in qualified expression
return (PsiTreeUtil.getParentOfType(nameExpression, JetQualifiedExpression.class) == null);
// Top level completion should be executed for simple name which is not in qualified expression
if (PsiTreeUtil.getParentOfType(nameExpression, JetQualifiedExpression.class) != null) {
return false;
}
// 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,3 @@
class Test : java.lang.A<caret>
// ABSENT: Annotation
@@ -172,6 +172,10 @@ public class JetBasicCompletionTest extends JetCompletionTestBase {
doTest();
}
public void testNoTopLevelCompletionInQualifiedUserTypes() {
doTest();
}
public void testOnlyScopedClassesWithoutExplicit() {
doTest();
}