java smart enter: place caret inside braces for switch statement followed by an empty line

This commit is contained in:
peter
2016-02-15 19:07:58 +01:00
parent 66b7599419
commit 0df183f2af
4 changed files with 21 additions and 0 deletions

View File

@@ -99,6 +99,10 @@ public class PlainEnterProcessor implements EnterProcessor {
if (methodBody != null) return methodBody;
}
if (element instanceof PsiSwitchStatement) {
return ((PsiSwitchStatement)element).getBody();
}
PsiStatement body = null;
if (element instanceof PsiIfStatement) {
body = ((PsiIfStatement)element).getThenBranch();

View File

@@ -0,0 +1,7 @@
class foo {
void foo() {
switch (i<caret>)
}
}

View File

@@ -0,0 +1,9 @@
class foo {
void foo() {
switch (i) {
<caret>
}
}
}

View File

@@ -218,6 +218,7 @@ public class CompleteStatementTest extends EditorActionTestCase {
public void testSwitchKeyword() throws Exception { doTest(); }
public void testSwitchKeywordWithCondition() throws Exception { doTest(); }
public void testSwitchBraces() { doTest(); }
public void testCaseColon() { doTest(); }
public void testNewInParentheses() throws Exception { doTest(); }