dfmt icon indicating copy to clipboard operation
dfmt copied to clipboard

heuristics: line breaks in nested function calls

Open linkrope opened this issue 10 years ago • 2 comments

unittest
{
    foo("123456789012345678901234567890", bar("123456789012345678901234567890", "123456789012345678901234567890"));
}

is badly reformatted as

unittest
{
    foo("123456789012345678901234567890", bar("123456789012345678901234567890",
        "123456789012345678901234567890"));
}

but should better be reformatted as

unittest
{
    foo("123456789012345678901234567890",
        bar("123456789012345678901234567890", "123456789012345678901234567890"));
}

linkrope avatar Apr 24 '15 13:04 linkrope

Why is it better? Can you specify a more formal optimization goal for dfmt?

For example, if you want to minimize line length, the current behavior is better.

qznc avatar Aug 06 '15 20:08 qznc

see Eclipse's Java formatter option: "Prefer wrapping outer expressions (keep nested expression on one line)"

linkrope avatar Aug 06 '15 21:08 linkrope