IDEA-118194 complete statement works strange for inner classes / enums

This commit is contained in:
peter
2013-12-15 20:04:52 +01:00
parent cef372d03c
commit 1e6cb22845
5 changed files with 20 additions and 4 deletions
@@ -123,7 +123,7 @@ public class PlainEnterProcessor implements EnterProcessor {
private static boolean processExistingBlankLine(@NotNull Editor editor, @Nullable PsiCodeBlock codeBlock, @Nullable PsiElement element) {
PsiWhiteSpace whiteSpace = null;
if (codeBlock == null) {
if (element != null) {
if (element != null && !(element instanceof PsiMember)) {
final PsiElement next = PsiTreeUtil.nextLeaf(element);
if (next instanceof PsiWhiteSpace) {
whiteSpace = (PsiWhiteSpace)next;
@@ -0,0 +1,6 @@
public class Foo {
public static enum MyEnum<caret>
public void foo() {
}
}
@@ -0,0 +1,8 @@
public class Foo {
public static enum MyEnum {
<caret>
}
public void foo() {
}
}
@@ -107,6 +107,8 @@ public class CompleteStatementTest extends EditorActionTestCase {
public void testMethod() throws Exception { doTest(); }
public void testClass() throws Exception { doTest(); }
public void testInnerEnumBeforeMethod() { doTest(); }
public void testCompleteElseIf() throws Exception { doTest(); }
@@ -269,11 +271,11 @@ public class CompleteStatementTest extends EditorActionTestCase {
}
}
private void doTest() throws Exception {
private void doTest() {
doTest("java");
}
private void doTest(String ext) throws Exception {
private void doTest(String ext) {
String path = "/codeInsight/completeStatement/";
doFileTest(path + getTestName(false) + "." + ext, path + getTestName(false) + "_after." + ext, true);
}
@@ -79,7 +79,7 @@ public abstract class EditorActionTestCase extends LightCodeInsightTestCase {
* @param ignoreTrailingSpaces true if trailing spaces should be ignored.
* @throws Exception
*/
protected void doFileTest(String filePathBefore, String filePathAfter, boolean ignoreTrailingSpaces) throws Exception {
protected void doFileTest(String filePathBefore, String filePathAfter, boolean ignoreTrailingSpaces) {
configureByFile(filePathBefore);
invokeAction();
checkResultByFile(null, filePathAfter, ignoreTrailingSpaces);