palantir-java-format
palantir-java-format copied to clipboard
Palantir formatter behaves weirdly with switch assignments
What happened?
How code was written:
float renderX, renderY;
renderX = switch (horizontalAlignment) {
case Left -> x;
case Center -> x - font.width(text) / 2f;
case Right -> x - font.width(text);
};
renderY = switch (verticalAlignment) {
case Top -> y;
case Middle -> y - font.lineHeight / 2f;
case Bottom -> y - font.lineHeight;
};
After Palantir (2.26.0) format:
float renderX, renderY;
renderX = switch (horizontalAlignment) {
case Left -> x;
case Center -> x - font.width(text) / 2f;
case Right -> x - font.width(text);};
renderY = switch (verticalAlignment) {
case Top -> y;
case Middle -> y - font.lineHeight / 2f;
case Bottom -> y - font.lineHeight;};
};
is in a weird place now.
What did you want to happen?
My suggestion is that };
should be auto-formatted to be in the next line after the last case.
#782