<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61560>61560</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] array initializer one per line
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
abdelmaged
</td>
</tr>
</table>
<pre>
I'd like to format array initializer to be one item per line, instead of all items in one line.
Example
I want this:
static char *categories[] = {
"Alpha",
"Beta",
"Gamma",
"Delta",
"Epsilon",
"Zeta",
"Eta",
"Theta",
"Iota",
"Kappa",
"Lambda",
"Mu",
"Nu",
"Xi",
"Omicoron",
"Pi",
"Rho",
"Sigma",
"Tau",
"Upsilon",
"Phi",
"Chi",
"Psi",
"Omega",
};
Not this:
static char *categories[] = {
"Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta",
"Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu",
"Nu", "Xi", "Omicoron", "Pi", "Rho", "Sigma",
"Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega",
};
There has been multiple question on stackoverflow with no way to achieve this:
https://stackoverflow.com/questions/69537052/clang-format-array-initializer-one-per-line
https://stackoverflow.com/questions/38058627/clang-format-array-initialisers
https://stackoverflow.com/questions/39144255/clang-format-removes-new-lines-in-array-definition-with-designators
https://stackoverflow.com/questions/75572012/clang-format-designated-initializer-one-member-per-line
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysld-PozYQx_8a8zIiIgaH8MDD7uZSrdrendqtVPXNwATc8w9qm023f30FSe4Ap6206ksivjOeGY8_muHOiVYjloQ9EnaI-OA7Y0teNSgVb7GJKtO8lc-E5g1I8QXBGzgZq7gHbi1_A6GFF1yKv9COtgrBaAThUUGPFqTQSOgTCO088gbMCbiUk92B0JPz6LMhyYEkD5ffD39y1UucS89w5tqD74Qj6cPc4jz3ooa64xYIfai5x9ZYge5yJSDpAUj-eHEGIJQ-yL7jhFJCn2bqI_qlSCj9jisVeh5Q-lD90DshjQ7039ZxJ-ebBjPxpcN78rO5p37P-z6M-wNXVRNc48chcPw4hCF_FaH2SYna2DvX-izWWX7qTOD1s2jvNPCFhwX98g_t-9ytqiKUPnUi9HOh9klhu8hO8gNJH-f0fDT_B1RrrJY8Xe0zmFYUBfjc52ZFTsBMQMuCkjUecI-MJRuwxAKuwpKJOQxXh68k3E7cwWAJAoQMrB5_9uqwfPBvZf3na790aBE67qBC1KAG6UUvEf4Y0HlhxnEEzvP6i3lFe5LmDGfhO9AGzvxtHG-87gS-4hKZzvt--qJHQo-L85vaKEKPt_iO0OOuYGmeMErosZZct_FlnMbTOI1n4zQ2GuMebTzN0HdkSvcJ2-9o_u-ZHFr3rujFNssoY-voFpV5RRdrPE-Vu1joa8oGT1NWo-Oxr3GD4_bh3ryvgpyxnCbboJO3sNgE7VSoKrRfuxo1ZdoUacEjLLe7vEizbM9Y1JWn0ylh2yytClo06X6f7euiYDnFXZ3xrMFIlDShaZLShCZZwtgm3WUFVnVS72t22hWUZAkqLuRGyle1MbaNhHMDlrst2yWR5BVKN21dSjWeYTKO8LJDZMvxTFwNrSNZIoXz7lsUL7yc1vX8yuNICtfxuFtvOzgarCyX7W2F74bq2tcx_vUv7q35HWtP6HGqaoJ2rPrvAAAA__8tdVE5">