mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-148214 After expanding indents restore only alignments which can be moved in the middle of line (isAllowBackwardShift == true)
This commit is contained in:
+29
@@ -126,6 +126,35 @@ public class JavaFormatterMultilineMethodCallParamsTest extends AbstractJavaForm
|
||||
");\n"
|
||||
);
|
||||
}
|
||||
|
||||
public void testMethodBracketsAlignment() {
|
||||
getSettings().ALIGN_MULTILINE_METHOD_BRACKETS = true;
|
||||
doTextTest(
|
||||
"public class Foo {\n" +
|
||||
" private IntPredicate example1() {\n" +
|
||||
" return Boo.combine(Boo.p1(),\n" +
|
||||
" Boo.p2());\n" +
|
||||
" }\n" +
|
||||
" \n" +
|
||||
" private boolean example2() {\n" +
|
||||
" return IntStream.range(0, 4).allMatch(Boo.combine(Boo.p1(),\n" +
|
||||
" Boo.p2()));\n" +
|
||||
" }\n" +
|
||||
"}",
|
||||
"public class Foo {\n" +
|
||||
" private IntPredicate example1() {\n" +
|
||||
" return Boo.combine(Boo.p1(),\n" +
|
||||
" Boo.p2());\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" private boolean example2() {\n" +
|
||||
" return IntStream.range(0, 4).allMatch(Boo.combine(Boo.p1(),\n" +
|
||||
" Boo.p2()));\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1650,7 +1650,10 @@ public class FormatProcessor {
|
||||
|
||||
private void restoreAlignments(MultiMap<Alignment, LeafBlockWrapper> blocks) {
|
||||
for (Alignment alignment : blocks.keySet()) {
|
||||
Set<LeafBlockWrapper> toRealign = ((AlignmentImpl)alignment).getOffsetResponsibleBlocks();
|
||||
AlignmentImpl alignmentImpl = (AlignmentImpl)alignment;
|
||||
if (!alignmentImpl.isAllowBackwardShift()) continue;
|
||||
|
||||
Set<LeafBlockWrapper> toRealign = alignmentImpl.getOffsetResponsibleBlocks();
|
||||
arrangeSpaces(toRealign);
|
||||
|
||||
LeafBlockWrapper rightMostBlock = getRightMostBlock(toRealign);
|
||||
|
||||
Reference in New Issue
Block a user