我想知道在Uncrustify中是否存在配置,以便可以实现以下格式化(或至少部分部分)(语言是objective-c)。
原始代码:
@interface BaseVideoViewController : BaseViewController <UICollectionViewDelegate, UICollectionViewDataSource, CircleTransitionFromController, PassiveUserGifCellDelegate, PassiveUserCollectionViewDelegate>
@property (strong, nonatomic) NSMutableArray <TokBoxParticipants *> *currentPassivePlayersArray;
@interface BaseVideoViewController () {
NSMutableArray <NSString *> *passiveUserForCellList;
}
[UIView animateWithDuration:1.0 parama1:2.0 animations:^{
// oc_block should come down if in same line by formatter
}
completion:^(BOOL finished) {
// something
}];
switch (something.state) {
case 0: {}
Break;
}
if (_voiceTextView == nil) {
格式化后所需的代码:
@interface BaseVideoViewController: BaseViewController <UICollectionViewDelegate, UICollectionViewDataSource, CircleTransitionFromController, PassiveUserGifCellDelegate, PassiveUserCollectionViewDelegate>
@property (strong, nonatomic) NSMutableArray <TokBoxParticipants *> *currentPassivePlayersArray;
@interface BaseVideoViewController() {
NSMutableArray<NSString *> *passiveUserForCellList;
}
[UIView animateWithDuration:1.0 parama1:2.0
animations:^{
// oc_block should come down if in same line by formatter
}
completion:^(BOOL finished) {
// something
}];
switch (something.state) {
case 0: {
Break;
}
}
if (_voiceTextView == nil) {
格式化后需要观察的更改:
答案 0 :(得分:1)
Uncrustify-0.65-106-95188777
sp_before_class_colon = remove
sp_before_angle
和sp_inside_angle
mod_move_case_break = true
应该这样做,但它似乎不适用于 OC 。它也不适用于 C ++ 的示例,除非Break
更改为break
且结束括号位于其自己的行上。提交功能并将请求提取到Uncrustify git repo