From ceb018b369d00e1a8d7e30f5ba30c2b8d4e300c1 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 13 Oct 2017 12:28:07 +0200 Subject: [PATCH] complete java class keywords after top-level annotation regression after IDEA-CR-25484 --- .../codeInsight/completion/JavaKeywordCompletion.java | 4 ++++ .../completion/keywords/afterAnnotationsWithParams.java | 1 + .../java/codeInsight/completion/KeywordCompletionTest.java | 1 + 3 files changed, 6 insertions(+) create mode 100644 java/java-tests/testData/codeInsight/completion/keywords/afterAnnotationsWithParams.java diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java index c5eb545fe984..9ead9fefffea 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java @@ -592,6 +592,10 @@ public class JavaKeywordCompletion { return true; } + if (psiElement().withParents(PsiErrorElement.class, PsiFile.class).accepts(position)) { + return true; + } + return isEndOfBlock(position); } diff --git a/java/java-tests/testData/codeInsight/completion/keywords/afterAnnotationsWithParams.java b/java/java-tests/testData/codeInsight/completion/keywords/afterAnnotationsWithParams.java new file mode 100644 index 000000000000..38c837dc8902 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/keywords/afterAnnotationsWithParams.java @@ -0,0 +1 @@ +@Deprecated() \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/KeywordCompletionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/KeywordCompletionTest.java index 1581c8dae3c0..e0e09ea7b0b9 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/KeywordCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/KeywordCompletionTest.java @@ -55,6 +55,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase { public void testClassScope4() { doTest(10, CLASS_SCOPE_KEYWORDS_2); } public void testInterfaceScope() { setLanguageLevel(LanguageLevel.JDK_1_8); doTest(8, INTERFACE_SCOPE_KEYWORDS); } public void testAfterAnnotations() { doTest(6, "public", "final", "class", "interface", "abstract", "enum", null); } + public void testAfterAnnotationsWithParams() { doTest(6, "public", "final", "class", "interface", "abstract", "enum", null); } public void testExtends1() { doTest(2, "extends", "implements", null); } public void testExtends2() { doTest(1, "extends", "implements", "AAA", "BBB", "instanceof"); } public void testExtends3() { doTest(2, "extends", "implements", "AAA", "BBB", "CCC", "instanceof"); }