c++ - 如何让 clang 格式优先于分解函数参数而不是将函数调用放在单独的行上
问题描述
我有一些看起来像这样的代码:
NTSTATUS status = co_await stateManager_->RemoveAsync(
transaction,
stateProviderName,
timeout,
cancellationToken);
当我尝试使用 clang 格式对其进行格式化时,它会产生这样的结果
NTSTATUS status = co_await stateManager_
->RemoveAsync(transaction, stateProviderName, timeout, cancellationToken);
如何获得 clang 格式来阻止这种中断的发生并优先考虑打破论点?对于一些具有较长参数列表的函数,它会保留原始格式,但是对于这样的调用,我无法得到不同的结果。
我的 clang 格式文件如下所示:
---
BasedOnStyle: Microsoft
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: true
SplitEmptyFunction: true
SplitEmptyNamespace: true
SplitEmptyRecord: true
BreakAfterJavaFieldAnnotations: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeComma
BreakConstructorInitializersBeforeComma: true
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DeriveLineEnding: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: true
FixNamespaceComments: false
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: false
KeepEmptyLinesAtTheStartOfBlocks: true
Language: Cpp
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 3
NamespaceIndentation: All
PenaltyBreakAssignment: 3
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 330
PenaltyBreakFirstLessLess: 138
PenaltyBreakString: 800
PenaltyExcessCharacter: 1221339
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Middle
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 10
UseTab: Never
UseCRLF: true
...
解决方案
推荐阅读
- powershell - 检查网站是否通过 PowerShell (5.1) 加载
- sql - 另一个表中存在单列行集或函数返回正值
- latex - 在 LaTeX 中设置 \newtheorem
- r - 是否有 R 函数来检查和删除数据框中的空字符串?
- angular - Rxjs 扫描不触发 combineLatest
- windows - 所有现有 WinApi 函数的列表
- android - Android:运行后台服务,无需运行应用程序。可能吗?
- r - 有条件地在其他变量的同一列中添加带有变量的行
- angular - 有什么方法可以在角度渲染中使用 *ngFor 的前 5 个结果并在浏览器中显示,其余的可以随着时间的推移加载
- python - 如何使用 python 访问谷歌驱动器中的 SQLite 数据库?