Skip to content

Commit

Permalink
fix: fix stable reformating when wrapping return statements (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
clementdessoude authored Nov 18, 2019
1 parent 1502d33 commit 51dff6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/prettier-plugin-java/src/printers/expressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,11 @@ class ExpressionsPrettierVisitor {
indent(
concat([
softline,
rejectAndJoinSeps(
sortedBinaryOperators.map(elt => concat([" ", elt, line])),
segmentsSplittedByBinaryOperator
group(
rejectAndJoinSeps(
sortedBinaryOperators.map(elt => concat([" ", elt, line])),
segmentsSplittedByBinaryOperator
)
)
])
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ Object returnSomethingWhichBreakAndAlreadyInParenthesis() {
);
}

// Bug fix #290
public boolean shouldBreakInOneLine(Example that) {
return oneVeryLongPrimaryExpression && andYetAnotherVeryVeryLongPrimaryExpression;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ Object returnSomethingWhichBreakAndAlreadyInParenthesis() {
seventhVariable
);
}

// Bug fix #290
public boolean shouldBreakInOneLine(Example that) {
return (
oneVeryLongPrimaryExpression && andYetAnotherVeryVeryLongPrimaryExpression
);
}
}

0 comments on commit 51dff6c

Please sign in to comment.