2

所以基本上我有这样的代码:

NSString *const SomeKey = @"SomeKey";


@implementation SomeClass


- (void)doSomeWork {
    [self startDoingSomeWork];



    [self stopDoingSomeWork];
    [self notifySomeWorkDone];
}

我需要将此代码自动格式化为这种形式:

NSString *const SomeKey = @"SomeKey";

@implementation SomeClass

- (void)doSomeWork {
    [self startDoingSomeWork];

    [self stopDoingSomeWork];
    [self notifySomeWorkDone];
}

所以基本上我需要用单个空行替换所有双、三等空行。

是否有任何 Uncrustify 选项可以启用它?
如果否,那么您知道这种情况的任何解决方法吗?

4

2 回答 2

4

最后我找到了正确的选择。
只需将此行添加到您的配置文件中:

nl_max = 2
于 2015-12-17T22:54:08.673 回答
1

如果 Uncrustify 不支持该功能,您可以尝试 ClangFormat。

MaxEmptyLinesToKeep: 1最多保留 1 个空行。

资料来源:函数定义之间的换行符

于 2015-12-17T00:55:40.460 回答