[clang-format] C feature request: always multi-line un-nested designated initializer
Open
clang-format
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
e.g.:
```C++
return (StrView){
.len = end - begin,
.chars = str + begin
};
```
```C++
int *arr = (int[]){
[10] = 2
};
```
adding a trailing comma makes clang-format does this, but I think it makes sense to have an option to always do it like this.
Contributor guide
Research direction
Start by reproducing the two designated-initializer examples with clang-format, both with and without a trailing comma, to confirm the current behavior. Then identify the clang-format formatting entry point and existing tests for initializer formatting, and define the new option's expected output for both examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100