prettier-java
prettier-java copied to clipboard
Missing indentation for division function
Prettier-Java 0.7.1
# Options (if any):
--print-width 90
Input:
public class Test {
public static void main(String[] args) {
if (oneLevelDeep) {
if (twoLevelsDeep) {
if (threeLevelsDeep) {
int successfulCount = 0;
int failureCount = 1;
double availability = (double) successfulCount / (successfulCount + failureCount);
}
}
}
}
}
Output:
public class Test {
public static void main(String[] args) {
if (oneLevelDeep) {
if (twoLevelsDeep) {
if (threeLevelsDeep) {
int successfulCount = 0;
int failureCount = 1;
double availability = (double) successfulCount /
(successfulCount + failureCount);
}
}
}
}
}
Expected behavior: I'm not 100% sure on what the expected behavior should be but I feel that the current output is non ideal.
I would guess having the parens indented 1 level would be okay instead on the same level as the declaration.
Hi, thanks for reporting this case ! It seems to be related to on how we handle binaryExpression. I think we need to refactor it again, althought we already did it multiple times as it is difficult to understand what it does exactly.
related issue #307