BreakTemplateDeclarations
选项设置为“是”,但是当格式化我的代码时,它仍然被放在同一行。例如
template<typename type> class Class{};
而不是
template<typename type>
class Class{};
有什么我忽略的吗?
我尝试了
BreakTemplateDeclarations
选项,我也尝试了(已弃用)AlwaysBreakTemplateDeclarations
选项,但没有任何效果。---
BasedOnStyle: WebKit
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Left
AlignOperands: AlignAfterOperator
AlignConsecutiveMacros: None
AlignEscapedNewlines: DontAlign
AlwaysBreakkTemplateDeclarations: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
BreakBeforeConceptDeclarations: Always
BreakTemplateDeclarations: Yes
ColumnLimit: 120
Cpp11BracedListStyle: true
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
FixNamespaceComments: true
IncludeBlocks: Regroup
IndentAccessModifiers: true
IndentCaseLabels: true
IndentExternBlock: Indent
IndentWidth: 4
InsertBraces: true
IntegerLiteralSeperator:
Binary: -1
Decimal: 3
DecimalMinDigits: 5
Hex: 2
HexMinDigits: 6
JavaScriptQuotes: Double
KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: false
LineEnding: LF
MaxEmptyLinesToKeep: 1
PackConstructorInitializers: NextLine
NamespaceIndentation: None
PenaltyReturnTypeOnItsOwnLine: 200
PenaltyBreakOpenParenthesis: 200
PenaltyBreakTemplateDeclaration: 0
PenaltyIndentedWhitespace: 1
PointerAlignment: Right
ReferenceAlignment: Right
RemoveParentheses: MultipleParentheses
SeperateDefinitionBlocks: Always
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesInAngles: Never
SpacesInContainerLiterals: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 1
SpacesInParens: Never
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Always
...
问题是您为键true
指定了错误的值
AlwaysBreakkTemplateDeclarations
。从clang 格式文档 可能的值是:
可能的值:
- 离开:请勿更改声明前的换行符。
- 否 : 声明前请勿强制中断。
- 是:模板声明后始终中断。
- MultiLine:仅当以下声明跨越多行时,才在模板声明后强制中断。