nic*_*ona 8 xcode objective-c ios clang-format
我在使用clang-format和blocks时遇到了一些麻烦.我想使用尾随块维护以下格式的方法调用:
[self presentViewController:alertController animated:YES completion:^{
NSLog(@"Output");
// Do something
}];
Run Code Online (Sandbox Code Playgroud)
我已将ColumnLimit设置为0,它可以在任何地方使用,但它的副作用是不在块内格式化任何内容(if语句,其他调用等).我可以找到格式化块内部代码的唯一方法是将ColumnLimit设置为> 0,但是,即使我将其设置为像100000这样的大小,它也会为每个参数添加中断,这是我不想要的:
[self presentViewController:alertController
animated:YES
completion:^{
NSLog(@"Output");
// Do something
}];
Run Code Online (Sandbox Code Playgroud)
因此,我想要的组合是对块内的代码进行适当格式化,而不涉及方法调用的任何其他内容.
我的clang格式配置:
Language: Cpp
ColumnLimit: 0
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLoopsOnASingleLine: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
IndentWidth: 4
TabWidth: 4
UseTab: Never
PointerAlignment: Right
DerivePointerAlignment: false
ObjCSpaceAfterProperty: true
BreakBeforeBraces: Stroustrup
AllowShortIfStatementsOnASingleLine: false
BreakBeforeTernaryOperators: false
IndentCaseLabels: true
AllowShortCaseLabelsOnASingleLine: false
AlignTrailingComments: true
BinPackParameters: false
BinPackArguments: false
AllowShortFunctionsOnASingleLine: false
IndentWrappedFunctionNames: false
ObjCSpaceBeforeProtocolList: true
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
SpacesBeforeTrailingComments: 1
ObjCBlockIndentWidth: 4
Run Code Online (Sandbox Code Playgroud)
Clang格式版本是3.6.
任何帮助都会很棒,不确定是否可以实现.
| 归档时间: |
|
| 查看次数: |
295 次 |
| 最近记录: |