mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-52529 enum member not suggested while adding a static array right in the enum class
This commit is contained in:
+3
-2
@@ -37,7 +37,6 @@ import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.patterns.ElementPattern;
|
||||
import com.intellij.patterns.PatternCondition;
|
||||
import static com.intellij.patterns.PsiJavaPatterns.*;
|
||||
import com.intellij.patterns.PsiNameValuePairPattern;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.filters.*;
|
||||
@@ -60,6 +59,8 @@ import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.patterns.PsiJavaPatterns.*;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
@@ -88,7 +89,7 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
@Nullable
|
||||
private static ElementFilter getReferenceFilter(PsiElement position) {
|
||||
// Completion after extends in interface, type parameter and implements in class
|
||||
final PsiClass containingClass = PsiTreeUtil.getParentOfType(position, PsiClass.class, false, PsiCodeBlock.class, PsiMethod.class, PsiExpressionList.class);
|
||||
final PsiClass containingClass = PsiTreeUtil.getParentOfType(position, PsiClass.class, false, PsiCodeBlock.class, PsiMethod.class, PsiExpressionList.class, PsiVariable.class);
|
||||
if (containingClass != null && psiElement().afterLeaf(PsiKeyword.EXTENDS, PsiKeyword.IMPLEMENTS, ",", "&").accepts(position)) {
|
||||
return new AndFilter(ElementClassFilter.CLASS, new NotFilter(new AssignableFromContextFilter()));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
public enum ButtonKey {
|
||||
CANCEL_ALL,
|
||||
CANCEL_SELL;
|
||||
|
||||
public static final ButtonKey[] ARR = {CANCEL_ALL, CANCEL_S<caret>};
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public enum ButtonKey {
|
||||
CANCEL_ALL,
|
||||
CANCEL_SELL;
|
||||
|
||||
public static final ButtonKey[] ARR = {CANCEL_ALL, CANCEL_SELL<caret>};
|
||||
}
|
||||
@@ -662,5 +662,7 @@ public class NormalCompletionTest extends LightCompletionTestCase {
|
||||
|
||||
public void testMethodParameterAnnotationClass() throws Throwable { doTest(); }
|
||||
|
||||
public void testEnumConstantFromEnumMember() throws Throwable { doTest(); }
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user