clang-format - Break each argument to new line
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Hi I am new to .clang-format.
I want each argument on new line ex.
```c
int
foo(
int x,
int b)
{
return (x + b);
}
```
but currently I am getting:
```c
int
foo(int x, int b)
{
return (x + b);
}
```
My current `.clang-format` is:
```
---
BasedOnStyle: Mozilla
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AlwaysBreakAfterDefinitionReturnType: All
AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: 'true'
AlwaysBreakTemplateDeclarations: 'Yes'
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: 'true'
ColumnLimit: '80'
ConstructorInitializerIndentWidth: '8'
ContinuationIndentWidth: '8'
DerivePointerAlignment: 'true'
FixNamespaceComments: 'true'
IndentCaseLabels: 'true'
IndentPPDirectives: BeforeHash
IndentWidth: '8'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
NamespaceIndentation: All
SortIncludes: 'false'
SortUsingDeclarations: 'true'
TabWidth: '8'
UseTab: Always
BinPackArguments: false
BinPackParameters: false
...
```
Contributor guide
Research direction
Reproduce the formatting shown with the provided .clang-format configuration and the C function example. Start by checking how clang-format handles BinPackArguments and BinPackParameters with AlignAfterOpenBracket: AlwaysBreak. Done means determining whether the requested one-argument-per-line output is supported by these options and documenting the result or required configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100