jhipster / prettier-java

Prettier Java Plugin
http://www.jhipster.tech/prettier-java/
Apache License 2.0
1.06k stars 103 forks source link

Make use of "Bracket Line" option #634

Closed andre-paris closed 2 weeks ago

andre-paris commented 5 months ago

Prettier-Java 2.5.0

# Options (if any):
--print-width 120 --bracket-same-line true

Input:

    public static BigDecimal manyArgsMethod(BigDecimal arg1, BigDecimal arg2, BigDecimal arg3, BigDecimal arg4, BigDecimal arg5) {
        return arg1.add(arg2).add(arg3).add(arg4).add(arg5);
    }

Output:

    public static BigDecimal manyArgsMethod(
        BigDecimal arg1,
        BigDecimal arg2,
        BigDecimal arg3,
        BigDecimal arg4,
        BigDecimal arg5
    ) {
        return arg1.add(arg2).add(arg3).add(arg4).add(arg5);
    }

Expected behavior: Use the Bracket Line option to keep the ) { at the end of the last line instead of being alone on the next line:

    public static BigDecimal manyArgsMethod(
        BigDecimal arg1,
        BigDecimal arg2,
        BigDecimal arg3,
        BigDecimal arg4,
        BigDecimal arg5) {
        return arg1.add(arg2).add(arg3).add(arg4).add(arg5);
    }
jtkiesel commented 2 weeks ago

This option is only meant to apply to HTML. See https://prettier.io/docs/en/options#bracket-line.