我使用 clang-format 来格式化我的代码。一切正常,除了块代码,你可以看到下面的代码,失败块有缩进 4 个空格......
_loginOperation = [CheckTIMPreparation tim_CheckPreparationSuccess:^{
[weakSelf checkIsJoinGroup];
} failure:^(NSString *errorString) {
[weakSelf showloginingViewWithFail];
}];
格式后:
_loginOperation = [CheckTIMPreparation tim_CheckPreparationSuccess:^{
[weakSelf checkIsJoinGroup];
}
failure:^(NSString *errorString) {
[weakSelf showloginingViewWithFail];
}];
如何自定义我的 clang 格式配置?
这是我的配置:
BasedOnStyle: LLVM
IndentWidth: 4
BreakBeforeBraces: Attach
AllowShortIfStatementsOnASingleLine: true
IndentCaseLabels: true
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ColumnLimit: 0
AlignTrailingComments: true
SpaceAfterCStyleCast: true
SpacesInParentheses: false
SpacesInSquareBrackets: false