IDEA-158497 "catch" completion of "try {}"

This commit is contained in:
peter
2016-07-25 18:35:39 +02:00
parent 09f208cf7e
commit 6b92a3aa95
3 changed files with 12 additions and 1 deletions
@@ -164,7 +164,7 @@ public class PreferByKindWeigher extends LookupElementWeigher {
isLastStatement(PsiTreeUtil.getParentOfType(myPosition, PsiStatement.class))) {
return MyResult.probableKeyword;
}
if (PsiKeyword.ELSE.equals(keyword) || PsiKeyword.FINALLY.equals(keyword)) {
if (PsiKeyword.ELSE.equals(keyword) || PsiKeyword.FINALLY.equals(keyword) || PsiKeyword.CATCH.equals(keyword)) {
return MyResult.probableKeyword;
}
if (PsiKeyword.TRUE.equals(keyword) || PsiKeyword.FALSE.equals(keyword)) {
@@ -0,0 +1,7 @@
class Log {
{
try {
} <caret>
}
}
@@ -781,4 +781,8 @@ class ContainerUtil extends ContainerUtilRt {
assert (myFixture.lookupElements[0].psiElement as PsiMethod).containingClass.name == 'ContainerUtil'
}
public void testPreferCatchAndFinallyAfterTry() {
checkPreferredItems 0, 'catch', 'finally'
}
}