-
-
Notifications
You must be signed in to change notification settings - Fork 115
Description
Binary operators are being wrapped in a Java-uncommon way.
Binary operator wrapping/indentation was, as far as I can see, last overhauled in #255 which "fixed" three issues. However, the discussion in #218 was sadly ignored. The ticket predominantly says that long lines should be wrapped before the binary operators, as that's common in Java. And yet the implementation wraps after the operators.
Prettier-Java 1.6.1
# Options (if any):
--print-width 80Input:
String path = "/" + someotherlongstuff + "/";Output:
String path =
"/" +
someotherlongstuff +
"/";Expected behavior:
String path
= "/"
+ someotherlongstuff
+ "/";or maybe
String path = "/"
+ someotherlongstuff
+ "/";This is accented by the fact that for multi-catch we already wrap by "my" rules:
} catch (
IOException
| FTPException
| NumberFormatException
| ParseException e
) {I understand that the decision has been done at some point and is not very likely to change now as there's already lots of formatted code out there. That said, the discussion around the matter was very clear that Java does things differently than the result, and I'm here to stand by that. At least I wanted to revisit the decision and either explicitly close it forever, or leave it open, gather feedback, and maybe change it in a future major version.