<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62566>62566</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Break options for all types of lists
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Stadly
      </td>
    </tr>
</table>

<pre>
    Breaking lists before comma gives (in my opinion) a very readable and maintainable syntax. Clang-Format currently supports this for inheritance lists and member initializer lists:

```c++
class MyClass
: Foo
, SomeOtherClass
, Bar
{
public:
  MyClass()
  : Foo{3}
  , SomeOtherClass{4, true}
  , Bar{}
  , m_Id{0}
  , m_Condition{false}
  {};
private:
  int m_Id;
  bool m_Condition;
};
```

Clang-Format currently does not have break options for parameter lists, argument lists, enumerator lists, or initializer lists.

We have a large code base (≈ 1.9 million lines) that breaks lists before comma instead of after comma. This is the major issue preventing us from adopting Clang-Format.

Is this something you would consider adding? If approved, I would be glad to help out implementing it. I've done some investigation, and it seems that we would just need a couple of new style options:

- `BreakParameters`
- `BreakArguments`
- `BreakEnums`
- `BreakInitializationList`

They would all behave similarly to [`BreakInheritanceList`](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#breakinheritancelist) and [`BreakConstructorInitializers`](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#breakconstructorinitializers). I don't think that they would conflict with any existing style options.

Here is an example of formatting that would be supported with the new style options:

```c++
// Parameter list
void MyFunc
( int a_par
, double something_more
, int input_par
, bool foo
);

// Argument list
MyFunc
( a_par
, something_more
, input_par
, foo
);

// Enumerator list
enum class MyEnum
{ FirstItem
, SomeOtherItem
, Thing
, Baz
};

// Initializer list
std::vector<int> MyVector
{ 1
, 1000
, 300000
, -2
, 12345678
, 9999
};

```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VkuP2zgM_jXKhZ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