我有以下代码,例如:
[cardRegistrationVC setCancelBlock:^{
[weakSelf.navigationController popViewControllerAnimated:YES];
}];
当我在上面应用clang格式时,它变成:
[cardRegistrationVC setCancelBlock:^{ [weakSelf.navigationController popViewControllerAnimated:YES]; }];
如您所见,该块内的代码显示在同一行上。但是我应该永远换行。
如何正确设置clang格式?我的以下设置文件:
BasedOnStyle: LLVM
AllowShortIfStatementsOnASingleLine: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
IndentCaseLabels: true
ColumnLimit: 120
ObjCSpaceAfterProperty: true
KeepEmptyLinesAtTheStartOfBlocks: true
PenaltyBreakString: 1000000
SpacesInContainerLiterals: false
最后,我最终编写了如下代码:
[cardRegistrationVC setCancelBlock:^{
[weakSelf.navigationController popViewControllerAnimated:YES];
}];
最后空行可以。或者您必须禁用列限制:
#ColumnLimit: 120
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句