Łukasz Baran
Łukasz Baran

Reputation: 1239

clang-format 15 - force function parameters into new line

I can't force clang-format into spliting function parameters into separate lines:

Current:

virtual void OnSlotSelected(class UArcAbilitySystemComponentBase* InArcASC, class UArcQuickBarComponent* QuickBar, const struct FArcSlotData* InSlot) const {};

Expected:

virtual void OnSlotSelected(class UArcAbilitySystemComponentBase* InArcASC
        , class UArcQuickBarComponent* QuickBar
        , const struct FArcSlotData* InSlot) const {};

I don't mind where exactly it is aligned (so long as it is consistent).

This my current config:

Language: Cpp
BasedOnStyle: LLVM
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
PointerAlignment: Left
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
BinPackArguments: false
BinPackParameters: false
#ExperimentalAutoDetectBinPacking: true
#PenaltyBreakBeforeFirstCallParameter: 1
#PenaltyBreakOpenParenthesis: 1
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: true
AlignTrailingComments: false
AlwaysBreakTemplateDeclarations: Yes
BraceWrapping: 
  AfterCaseLabel: true
  AfterClass: true
  AfterControlStatement: true
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: true
  AfterStruct: true
  AfterUnion: true
  AfterExternBlock: false
  BeforeCatch: true
  BeforeElse: true
  BeforeLambdaBody: true
  BeforeWhile: true
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
BreakBeforeBraces: Custom
ColumnLimit: 0
IncludeCategories: 
  - Regex: '^<.*'
    Priority: 1
  - Regex: '^".*'
    Priority: 2
  - Regex: '.*'
    Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseBlocks: true
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
MacroBlockBegin: ''
MacroBlockEnd: ''
NamespaceIndentation: All
SpacesInAngles: false
TabWidth: 4
UseTab: Always

Upvotes: 0

Views: 135

Answers (1)

Jonny Soe
Jonny Soe

Reputation: 379

Remove ColumnLimit, your 0 means unlimited line width (LLVM breaks at 80 characters) so nothing will trigger line break

Upvotes: 1

Related Questions