mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
IDEA-118194 complete statement works strange for inner classes / enums
This commit is contained in:
+1
-1
@@ -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() {
|
||||
}
|
||||
}
|
||||
+8
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user