0
我想知道在Uncrustify中是否存在配置,以便可以实现格式化(或至少某些部分)(语言是objective-c)。Uncrustify格式化程序中newLine for block参数的配置
原始代码:
格式化后@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) {
在格式化之后被观察到的变化:
- 有 '如果' 和'之间的空间(',但我不想在'BaseVideoViewController'和'('之间留出空间。
- 我不希望接口名称,即'BaseVideoViewController'和':'之间的空间。
- 我想在接口或属性定义中的数据类型和角括号('<')之间的空间,但不是在代码中的其他地方。
- 注意break语句的更改。
- 当调用函数时,如果参数的值从'^'(参数名称动画,上面代码中的完成)开始,我希望参数进入换行。
谢谢你的投入和时间。你可以看看这个问题[链接](https://stackoverflow.com/questions/45772985/uncrustify-objective-c-parameter-value-alignment-indentation)也与uncrustify有关。 – user3247895