IDEA-99523 "final" should be suggested after "case"

This commit is contained in:
peter
2013-01-22 18:24:36 +01:00
parent 87fc02d024
commit ee50f08e29
3 changed files with 10 additions and 1 deletions
@@ -416,7 +416,7 @@ public class JavaCompletionData extends JavaAwareCompletionData {
statement = PsiTreeUtil.getParentOfType(position, PsiDeclarationStatement.class);
}
if (statement != null && statement.getTextRange().getStartOffset() == position.getTextRange().getStartOffset()) {
if (!psiElement().withSuperParent(2, PsiSwitchStatement.class).accepts(statement)) {
if (!psiElement().withSuperParent(2, PsiSwitchStatement.class).afterLeaf("{").accepts(statement)) {
result.addElement(new OverrideableSpace(createKeyword(position, PsiKeyword.FINAL), TailType.HUMBLE_SPACE_BEFORE_WORD));
}
}
@@ -0,0 +1,8 @@
public class StructuredConfigKey {
{
switch (x) {
case 2:
<caret>
}
}
}
@@ -109,6 +109,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
public void testReturnInTernary() throws Exception { doTest(1, "return"); }
public void testFinalAfterParameterAnno() throws Exception { doTest(2, "final", "float", "class"); }
public void testFinalAfterParameterAnno2() throws Exception { doTest(2, "final", "float", "class"); }
public void testFinalAfterCase() throws Exception { doTest(3, "final", "float", "class"); }
public void testFinalInTryWithResources() throws Exception { doTest(1, "final", "float", "class"); }
public void testClassInMethod() throws Exception { doTest(2, "class", "char"); }
public void testIntInClassArray() throws Throwable { doTest(2, "int", "char", "final"); }