mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-112387 Reformat code with rearrange entires on = fail on enum [CR-IC-2205]
This commit is contained in:
+12
@@ -131,4 +131,16 @@ class Test {
|
||||
}'''
|
||||
doTest(initial: text, expected: text, rules: [rule(CLASS)] )
|
||||
}
|
||||
|
||||
void "test statements on the same line"() {
|
||||
def before = '''\
|
||||
|
||||
|
||||
|
||||
public enum Sender {a, b; private String value;
|
||||
}
|
||||
'''
|
||||
doTest(initial: before, expected: before)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
@@ -639,6 +639,10 @@ public class ArrangementEngine {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return position <code>x</code> for which <code>myDocument.getText().substring(x, startOffset)</code> contains
|
||||
* <code>blankLinesNumber</code> line feeds and <code>myDocument.getText.charAt(x-1) == '\n'</code>
|
||||
*/
|
||||
private int getBlankLineOffset(int blankLinesNumber, int startOffset) {
|
||||
int startLine = myDocument.getLineNumber(startOffset);
|
||||
if (startLine <= 0) {
|
||||
|
||||
+7
-15
@@ -119,25 +119,17 @@ public class ArrangementEntryWrapper<E extends ArrangementEntry> {
|
||||
|
||||
@SuppressWarnings("AssignmentToForLoopParameter")
|
||||
public void updateBlankLines(@NotNull Document document) {
|
||||
int startLine = document.getLineNumber(getStartOffset());
|
||||
myBlankLinesBefore = 0;
|
||||
if (startLine <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int lineFeeds = 0;
|
||||
CharSequence text = document.getCharsSequence();
|
||||
int lastLineFeed = document.getLineStartOffset(startLine) - 1;
|
||||
for (int i = lastLineFeed - 1; i >= 0; i--) {
|
||||
i = CharArrayUtil.shiftBackward(text, i, " \t");
|
||||
if (text.charAt(i) == '\n') {
|
||||
++myBlankLinesBefore;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
for (int current = getStartOffset() - 1; current >= 0; current--) {
|
||||
current = CharArrayUtil.shiftBackward(text, current, " \t");
|
||||
if (text.charAt(current) == '\n') lineFeeds++;
|
||||
else break;
|
||||
}
|
||||
if (lineFeeds > 0) myBlankLinesBefore = lineFeeds - 1;
|
||||
}
|
||||
|
||||
|
||||
public void setNext(@Nullable ArrangementEntryWrapper<E> next) {
|
||||
myNext = next;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user