IDEA-89114 Unsuitable completion proposals in annotation attribute value

This commit is contained in:
peter
2012-07-23 15:45:32 +02:00
parent 112fa67418
commit 65643aa190
3 changed files with 24 additions and 3 deletions
@@ -135,6 +135,7 @@ public class JavaCompletionData extends JavaAwareCompletionData {
and(JavaSmartCompletionContributor.INSIDE_EXPRESSION,
not(psiElement().afterLeaf(PsiKeyword.CASE)),
not(psiElement().afterLeaf(psiElement().withText(".").afterLeaf(PsiKeyword.THIS, PsiKeyword.SUPER))),
not(psiElement().inside(PsiAnnotation.class)),
not(START_SWITCH));
public static final AndFilter CLASS_START = new AndFilter(
@@ -142,7 +143,8 @@ public class JavaCompletionData extends JavaAwareCompletionData {
END_OF_BLOCK,
new PatternFilter(psiElement().afterLeaf(
or(
psiElement().withoutText(".").inside(psiElement(PsiModifierList.class).withParent(not(psiElement(PsiParameter.class)))),
psiElement().withoutText(".").inside(psiElement(PsiModifierList.class).withParent(not(psiElement(PsiParameter.class)))).andNot(
psiElement().inside(PsiAnnotationParameterList.class)),
psiElement().isNull())))
),
new PatternFilter(not(psiElement().afterLeaf("@"))));
@@ -486,8 +488,10 @@ public class JavaCompletionData extends JavaAwareCompletionData {
}
if (EXPR_KEYWORDS.accepts(position)) {
result.addElement(TailTypeDecorator.withTail(createKeyword(position, PsiKeyword.NEW), TailType.INSERT_SPACE));
result.addElement(createKeyword(position, PsiKeyword.NULL));
if (PsiTreeUtil.getParentOfType(position, PsiAnnotation.class) == null) {
result.addElement(TailTypeDecorator.withTail(createKeyword(position, PsiKeyword.NEW), TailType.INSERT_SPACE));
result.addElement(createKeyword(position, PsiKeyword.NULL));
}
result.addElement(createKeyword(position, PsiKeyword.TRUE));
result.addElement(createKeyword(position, PsiKeyword.FALSE));
}