IDEA-119740 Ctrl+Shift+Space does not complete exception type after "final"

This commit is contained in:
peter
2014-01-23 10:45:22 +01:00
parent b2dc0d2beb
commit 76956c0ebe
4 changed files with 24 additions and 5 deletions
@@ -302,10 +302,10 @@ public class JavaSmartCompletionContributor extends CompletionContributor {
});
final Key<PsiTryStatement> tryKey = Key.create("try");
extend(CompletionType.SMART, psiElement().afterLeaf(
psiElement().withText("("))
.withSuperParent(3, psiElement(PsiCatchSection.class).withParent(
psiElement(PsiTryStatement.class).save(tryKey))), new CompletionProvider<CompletionParameters>() {
extend(CompletionType.SMART, psiElement().insideStarting(
psiElement(PsiTypeElement.class).withParent(
psiElement(PsiCatchSection.class).withParent(
psiElement(PsiTryStatement.class).save(tryKey)))), new CompletionProvider<CompletionParameters>() {
@Override
protected void addCompletions(@NotNull final CompletionParameters parameters, final ProcessingContext context, @NotNull final CompletionResultSet result) {
final PsiCodeBlock tryBlock = context.get(tryKey).getTryBlock();
@@ -0,0 +1,9 @@
class A{
{
try{
throw new Exception();
}
catch(final Exception <caret>)
}
}
@@ -0,0 +1,9 @@
class A{
{
try{
throw new Exception();
}
catch(final <caret>)
}
}
@@ -317,7 +317,8 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
checkResultByFile(path + "/after2.java");
}
public void testInsideCatch() throws Exception { doTest(); }
public void testInsideCatch() { doTest(); }
public void testInsideCatchFinal() { doTest(); }
public void testGenerics6() throws Exception {
String path = "/generics";