Skip to content

[clang-format] AlignOperands: AlignAfterOperator misaligns when combined with AlignConsecutiveAssignments #57612

@gerboengels

Description

@gerboengels
$ clang-format --version
clang-format version 15.0.0

Input/what I expect:

$ cat expected.cpp
auto someLongName = 3;
auto x            = someLoooooooooooooooooooooooooooooooooooongExpression
                  | ranges::views::values;

What I get:

$ clang-format --style="{ AlignOperands: AlignAfterOperator, AlignConsecutiveAssignments: true, BreakBeforeBinaryOperators: true  }" expected.cpp
auto someLongName = 3;
auto x            = someLoooooooooooooooooooooooooooooooooooongExpression
       | ranges::views::values;

So the operand after the pipe-operator gets aligned before clang-format aligns the assignment of x with the previous assignment.
I'd expect it the other way round: first align the assignments, and then align the operands

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions