Issue 79171
Summary [clang-format] Strange formatting of chained calls with AlignAfterOpenBracket: BlockIndent
Labels clang-format
Assignees
Reporter flyx
    When I use `AlignAfterOpenBracket: BlockIndent` with chained calls, the formatted code looks like this:

```c++
object
    .call1(
        some, args, that, dont, fit, inline
    )
    .call2(
        some, more, args, given, here
    );
```

The idea of `BlockIndent`, at least for me, is to use block indentation *instead of* continuation indentation, but the result here unnecessarily uses both. Also I question why clang-format would break after `)` and `.call2`, this might make sense for other styles but not for `BlockIndent`. I would expect the formatted code to be

```c++
object.call1(
    some, args, that, dont, fit, inline
).call2(
    some, more, args, given, here
);
```

This might be more relevant for _javascript_ formatting where chained calls are more common.

This is technically more of a feature request than a bug report since there isn't a an objective reason why the generated formatting would be wrong, however I do hold the opinion that the intent behind the `BlockIndent` setting is violated by what clang-format currently produces.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to