mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
[java-completion] Do not insert semicolon automatically into for-update statement
Fixes IDEA-326232 Suppress semicolon for the next iteration part in for-loop GitOrigin-RevId: 4ceeb1c673fdbabf59f2e31610a1012f1fb07cc4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6c02bcf415
commit
e4aa26c19c
@@ -868,6 +868,10 @@ public final class JavaCompletionUtil {
|
||||
if (parent instanceof PsiLambdaExpression && !LambdaHighlightingUtil.insertSemicolonAfter((PsiLambdaExpression)parent)) {
|
||||
insertAdditionalSemicolon = false;
|
||||
}
|
||||
if (parent instanceof PsiExpressionStatement && parent.getParent() instanceof PsiForStatement forStatement &&
|
||||
forStatement.getUpdate() == parent) {
|
||||
insertAdditionalSemicolon = false;
|
||||
}
|
||||
}
|
||||
if (insertAdditionalSemicolon) {
|
||||
toInsert = TailType.SEMICOLON;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.*;
|
||||
|
||||
class SomeTest {
|
||||
void a() {
|
||||
Collection<?> c = Collections.emptyList();
|
||||
|
||||
for(Iterator<?> i=c.iterator(); i.hasNext();i.rem<caret>) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import java.util.*;
|
||||
|
||||
class SomeTest {
|
||||
void a() {
|
||||
Collection<?> c = Collections.emptyList();
|
||||
|
||||
for(Iterator<?> i=c.iterator(); i.hasNext();i.remove()<caret>) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -959,6 +959,9 @@ public class NormalCompletionTest extends NormalCompletionTestCase {
|
||||
@NeedsIndex.ForStandardLibrary
|
||||
public void testNoSemicolonAfterExistingParenthesesEspeciallyIfItsACast() { doTest(); }
|
||||
|
||||
@NeedsIndex.ForStandardLibrary
|
||||
public void testNoSemicolonInForUpdate() { doTest("\n"); }
|
||||
|
||||
public void testReturningTypeVariable() { doTest(); }
|
||||
|
||||
public void testReturningTypeVariable2() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user