Is there an option in clang format to put the initializer lists of constructors on the next line in C++?

Viewed 329

Clang format formats this:

Rect(Pos pos, Dim dim)
  : m_pos(pos), m_dim(dim) {}

to this:

Rect(Pos pos, Dim dim) : m_pos(pos), m_dim(dim) {}

is there an option where you can say that the initializer list of constructors should break before the : in clang format?

This is my .clang-format file

Language: Cpp
BasedOnStyle: LLVM
IndentCaseLabels: true
NamespaceIndentation: All
AlwaysBreakAfterReturnType: None
SpaceBeforeInheritanceColon: false
AlwaysBreakTemplateDeclarations: Yes
AllowShortFunctionsOnASingleLine: All
BreakConstructorInitializers: BeforeColon
ConstructorInitializerAllOnOneLineOrOnePerLine: false

Edit: The first example is an example of the formatting I want. The second example is what clang-format does to my code.

0 Answers
Related