mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
IDEA-119926 Completing Statements doesn't go to next line for non conditional statements
This commit is contained in:
+7
-2
@@ -44,8 +44,8 @@ public class AfterSemicolonEnterProcessor implements EnterProcessor {
|
||||
((PsiMethod) psiElement).hasModifierProperty(PsiModifier.NATIVE))) {
|
||||
int errorOffset = getErrorElementOffset(psiElement);
|
||||
int elementEndOffset = psiElement.getTextRange().getEndOffset();
|
||||
final CharSequence text = editor.getDocument().getCharsSequence();
|
||||
if (psiElement instanceof PsiEnumConstant) {
|
||||
final CharSequence text = editor.getDocument().getCharsSequence();
|
||||
final int commaOffset = CharArrayUtil.shiftForwardUntil(text, elementEndOffset, ",");
|
||||
if (commaOffset < text.length()) {
|
||||
elementEndOffset = commaOffset + 1;
|
||||
@@ -53,13 +53,18 @@ public class AfterSemicolonEnterProcessor implements EnterProcessor {
|
||||
}
|
||||
|
||||
if (errorOffset >= 0 && errorOffset < elementEndOffset) {
|
||||
final CharSequence text = editor.getDocument().getCharsSequence();
|
||||
if (text.charAt(errorOffset) == ' ' && text.charAt(errorOffset + 1) == ';') {
|
||||
errorOffset++;
|
||||
}
|
||||
}
|
||||
|
||||
editor.getCaretModel().moveToOffset(errorOffset >= 0 ? errorOffset : elementEndOffset);
|
||||
if (errorOffset < 0 &&
|
||||
isModified &&
|
||||
(elementEndOffset == text.length() || text.charAt(elementEndOffset) == '\n') &&
|
||||
(psiElement instanceof PsiExpressionStatement || psiElement instanceof PsiDeclarationStatement)) {
|
||||
JavaSmartEnterProcessor.plainEnter(editor);
|
||||
}
|
||||
return isModified;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -3,6 +3,7 @@ class Foo {
|
||||
abstract void a();
|
||||
|
||||
{
|
||||
a();<caret>
|
||||
a();
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -3,6 +3,7 @@ class Foo {
|
||||
abstract void a();
|
||||
|
||||
{
|
||||
a();<caret>
|
||||
a();
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
public class Foo {
|
||||
public void fails() {
|
||||
boolean[] a = new boolean[f()];<caret>
|
||||
boolean[] a = new boolean[f()];
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ public class test {
|
||||
int k1 = 1;
|
||||
int k2 = 2;
|
||||
int[] array = new int[]{k1, k2};
|
||||
<caret>
|
||||
|
||||
System.out.print(k1);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
public class Test {
|
||||
public int foo(int i) {
|
||||
int ii = foo(0);<caret>
|
||||
int ii = foo(0);
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
public class Foo {
|
||||
public void foo() {
|
||||
foo();<caret>
|
||||
foo();
|
||||
<caret>
|
||||
// some line comment
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
public class Junk {
|
||||
public static void main(String[] args) {
|
||||
int i = 1; // comment<caret>
|
||||
int i = 1; // comment
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
public class Junk {
|
||||
public static void main(String[] args) {
|
||||
int[] arr = new int[]{1, 2, 3};<caret>
|
||||
int[] arr = new int[]{1, 2, 3};
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
|
||||
public class Foo {
|
||||
{
|
||||
foo();<caret>
|
||||
foo();
|
||||
<caret>
|
||||
foo();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
class Test {
|
||||
Object method() {
|
||||
method(
|
||||
factory());<caret>
|
||||
factory());
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
class foo {
|
||||
{
|
||||
Object d = ((String) new String());<caret>
|
||||
Object d = ((String) new String());
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
class Foo {
|
||||
{
|
||||
tx2 = (long) (vcx + vw);<caret>
|
||||
tx2 = (long) (vcx + vw);
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
class foo {
|
||||
{
|
||||
String s = "a";<caret>
|
||||
String s = "a";
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -8,6 +8,7 @@ class Tester {
|
||||
}
|
||||
|
||||
public void test1() {
|
||||
build(new EntityBuilder());<caret>
|
||||
build(new EntityBuilder());
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ public class MyJavaClass {
|
||||
|
||||
{
|
||||
|
||||
List l = new ArrayList(239);<caret>
|
||||
List l = new ArrayList(239);
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ public class Foo {
|
||||
|
||||
{
|
||||
Foo foo = null;
|
||||
Foo bar = id(foo);<caret>
|
||||
Foo bar = id(foo);
|
||||
<caret>
|
||||
}
|
||||
|
||||
Foo id(Foo foo) {return foo;}
|
||||
|
||||
Reference in New Issue
Block a user