mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-68660 ctrl-shift-enter does not insert a semicolon after anonymous implementation
This commit is contained in:
+7
-2
@@ -274,10 +274,15 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
|
||||
@Override
|
||||
@Nullable
|
||||
protected PsiElement getStatementAtCaret(Editor editor, PsiFile psiFile) {
|
||||
final PsiElement atCaret = super.getStatementAtCaret(editor, psiFile);
|
||||
PsiElement atCaret = super.getStatementAtCaret(editor, psiFile);
|
||||
|
||||
if (atCaret instanceof PsiWhiteSpace) return null;
|
||||
if (atCaret instanceof PsiJavaToken && "}".equals(atCaret.getText()) && !(atCaret.getParent() instanceof PsiArrayInitializerExpression)) return null;
|
||||
if (atCaret instanceof PsiJavaToken && "}".equals(atCaret.getText())) {
|
||||
atCaret = atCaret.getParent();
|
||||
if (!(atCaret instanceof PsiAnonymousClass || atCaret instanceof PsiArrayInitializerExpression)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
PsiElement statementAtCaret = PsiTreeUtil.getParentOfType(atCaret,
|
||||
PsiStatement.class,
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Foo {
|
||||
void a() {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}<caret>
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Foo {
|
||||
void a() {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
};<caret>
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,8 @@ public class CompleteStatementTest extends EditorActionTestCase {
|
||||
|
||||
public void testAddMissingSemicolonToPackageStatement() { doTest(); }
|
||||
|
||||
public void testAddMissingSemicolonAfterAnonymous() { doTest(); }
|
||||
|
||||
public void testAddMissingParen() throws Exception { doTest(); }
|
||||
|
||||
public void testCompleteIf() throws Exception { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user