mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-161250 Semicolon added in the middle of code
This commit is contained in:
@@ -802,12 +802,12 @@ public class JavaCompletionUtil {
|
||||
}
|
||||
|
||||
boolean insertAdditionalSemicolon = true;
|
||||
final PsiReferenceExpression referenceExpression = PsiTreeUtil.getTopmostParentOfType(context.getFile().findElementAt(context.getStartOffset()), PsiReferenceExpression.class);
|
||||
if (referenceExpression instanceof PsiMethodReferenceExpression && LambdaHighlightingUtil
|
||||
.insertSemicolon(referenceExpression.getParent())) {
|
||||
PsiElement leaf = context.getFile().findElementAt(context.getStartOffset());
|
||||
PsiElement composite = leaf == null ? null : leaf.getParent();
|
||||
if (composite instanceof PsiMethodReferenceExpression && LambdaHighlightingUtil.insertSemicolon(composite.getParent())) {
|
||||
insertAdditionalSemicolon = false;
|
||||
} else if (referenceExpression != null) {
|
||||
PsiElement parent = referenceExpression.getParent();
|
||||
} else if (composite instanceof PsiReferenceExpression) {
|
||||
PsiElement parent = composite.getParent();
|
||||
if (parent instanceof PsiMethodCallExpression) {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Util {
|
||||
{
|
||||
foo(() -> System.out.print<caret>).bar();
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Util {
|
||||
{
|
||||
foo(() -> System.out.println()<caret>).bar();
|
||||
}
|
||||
}
|
||||
+6
@@ -259,4 +259,10 @@ class Test88 {
|
||||
void testNoCollectorsInComment() { doAntiTest() }
|
||||
|
||||
void testNoContinueInsideLambdaInLoop() { doAntiTest(); }
|
||||
|
||||
void testNoSemicolonAfterVoidMethodInLambda() {
|
||||
configureByTestName()
|
||||
myFixture.type('l\t')
|
||||
checkResultByFile(getTestName(false) + "_after.java")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user