mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inserting paired brace for lambda body (following IDEA-CR-8127)
This commit is contained in:
@@ -142,9 +142,10 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
|
||||
}, "Insert block statement", null);
|
||||
return Result.STOP;
|
||||
}
|
||||
|
||||
if (leaf != null && PsiTreeUtil.getParentOfType(PsiTreeUtil.prevVisibleLeaf(leaf), PsiNewExpression.class, true,
|
||||
PsiCodeBlock.class, PsiMember.class) != null) {
|
||||
|
||||
PsiElement prevLeaf = leaf == null ? null : PsiTreeUtil.prevVisibleLeaf(leaf);
|
||||
if (PsiUtil.isJavaToken(prevLeaf, JavaTokenType.ARROW) ||
|
||||
PsiTreeUtil.getParentOfType(prevLeaf, PsiNewExpression.class, true, PsiCodeBlock.class, PsiMember.class) != null) {
|
||||
return Result.CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
void m() {
|
||||
javax.swing.SwingUtilities.invokeLater(() -> {<caret>});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
void m() {
|
||||
javax.swing.SwingUtilities.invokeLater(() -> <caret>);
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,10 @@ public class JavaTypingTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
doTest('{');
|
||||
}
|
||||
|
||||
public void testInsertPairedBraceForLambdaBody() {
|
||||
doTest('{');
|
||||
}
|
||||
|
||||
private void doTest(char c) {
|
||||
myFixture.configureByFile(getTestName(true) + "_before.java");
|
||||
myFixture.type(c);
|
||||
|
||||
Reference in New Issue
Block a user