<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Hello,</div><div class=""><br class=""></div><div class="">I've introduced clang-format (current version 8.0) to enforce some company coding guideline but I am struggling with list initializers.</div><div class=""><br class=""></div><div class="">The formatter works nicely with function declarations and function calls and aligns arguments on break like that:</div><div class=""><br class=""></div><div class=""><div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, "Courier New", monospace; line-height: 18px; white-space: pre;" class=""><div class=""><span style="color: #569cd6;" class="">static</span> <span style="color: #569cd6;" class="">void</span> <span style="color: #dcdcaa;" class="">someUnitInternalFunction</span>(</div><div class=""> <span style="color: #569cd6;" class="">const</span> uint32 <span style="color: #9cdcfe;" class="">someParameter</span>,</div><div class=""> uint32 *<span style="color: #9cdcfe;" class="">somePointer</span>,</div><div class=""> uint32 <span style="color: #9cdcfe;" class="">normalParameter</span>,</div><div class=""> uint8 <span style="color: #9cdcfe;" class="">anotherParameterLong</span>);</div><div class=""><div style="line-height: 18px;" class=""><br class=""><div class="">uint32 <span style="color: #dcdcaa;" class="">SomeUnitWithSomeVeryLongFunctionName</span>(</div><div class=""> uint32 <span style="color: #9cdcfe;" class="">parameterOne</span>,</div><div class=""> uint32 <span style="color: #9cdcfe;" class="">parameterTwo</span>,</div><div class=""> uint32 <span style="color: #9cdcfe;" class="">parameterThree</span>,</div><div class=""> uint32 <span style="color: #9cdcfe;" class="">parameterFour</span>)</div><div class="">{</div><div class=""> <span style="color: #dcdcaa;" class="">someUnitInternalFunction</span>(</div><div class=""> someInternalVariableWithSomeVeryLongName,</div><div class=""> &yetAnotherInternalVariableLongNameStyle,</div><div class=""> nowThisNameIsShorter,</div><div class=""> nowThisNameIsShorter);</div><div class="">}</div></div></div></div></div><div class=""><br class=""></div><div class="">This matches the configured continuation indent width. For lists, however, the indent does not match what I've expected: A list that exceeds the configured margin is formatted as following (I'm using <strong style="caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.399999618530273px;" class="">Cpp11BracedListStyle: true</strong>):</div><div class=""><br class=""></div><div class=""><div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, "Courier New", monospace; line-height: 18px; white-space: pre;" class=""><div class=""><span style="color: #569cd6;" class="">static</span> uint8 CddDp83848Reg<span style="color: #569cd6;" class="">[]</span> = {CDDDP83848_BMCR_REGISTER,</div><div class=""> CDDDP83848_BMSR_REGISTER,</div><div class=""> CDDDP83848_PHYIDR1_REGISTER,</div><div class=""> CDDDP83848_PHYIDR2_REGISTER,</div><div class=""> CDDDP83848_PHYSTS_REGISTER,</div><div class=""> CDDDP83848_RBR_REGISTER};</div></div></div><div class=""><br class=""></div><div class="">Whereas I'd expect it the following style:</div><div class=""><br class=""></div><div class=""><div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, "Courier New", monospace; line-height: 18px; white-space: pre;" class=""><div class=""><span style="color: #569cd6;" class="">static</span> uint8 CddDp83848Reg<span style="color: #569cd6;" class="">[]</span> = {</div><div class=""> CDDDP83848_BMCR_REGISTER,</div><div class=""> CDDDP83848_BMSR_REGISTER,</div><div class=""> CDDDP83848_PHYIDR1_REGISTER,</div><div class=""> CDDDP83848_PHYIDR2_REGISTER,</div><div class=""> CDDDP83848_PHYSTS_REGISTER,</div><div class=""> CDDDP83848_RBR_REGISTER};</div></div></div><div class=""><br class=""></div><div class="">According to the documentation</div><div class=""><br class=""></div><div class=""><span style="caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.399999618530273px; text-align: justify; background-color: rgb(255, 255, 255);" class="">Fundamentally, C++11 braced lists are formatted <b class="">exactly like function calls</b> would be formatted in their place. If the braced list follows a name (e.g. a type or variable name), clang-format formats as if the </span><code class="literal notranslate docutils" style="background-color: rgb(226, 226, 226); font-size: 1em; caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51); text-align: justify;"><span class="pre" style="-webkit-hyphens: none;">{}</span></code><span style="caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 14.399999618530273px; text-align: justify; background-color: rgb(255, 255, 255);" class=""> were the parentheses of a function call with that name. If there is no name, a zero-length name is assumed.</span></div><div class=""><br class=""></div><div class="">And I have the following setting: ContinuationIndentWidth: 4. As you can see the function call is formatted nicely whereas the list initializer isn't, according to the documentation the formatting should be the same.</div><div class=""><br class=""></div><div class="">Can someone please help me out here? I've checked several settings and can't make clang-format indent initializers according to the (admittedly a bit special) style.</div><div class=""><br class=""></div><div class="">Thanks and BR,</div><div class="">Martin</div><div class=""><br class=""></div><div class="">Attached demo file and clang-format settings</div><div class=""><br class=""></div></body></html>