【问题标题】:Uncrustify: Remove double and more empty lines in ObjC codeUncrustify:删除 ObjC 代码中的双空行和更多空行
【发布时间】:2016-03-23 08:07:39
【问题描述】:

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

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 选项可以启用它?
如果否,那么您知道这种情况的任何解决方法吗?

【问题讨论】:

    标签: objective-c uncrustify


    【解决方案1】:

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

    nl_max = 2
    

    【讨论】:

      【解决方案2】:

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

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

      来源:Line breaks between function definitions

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-05-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-15
        • 2012-11-20
        • 1970-01-01
        相关资源
        最近更新 更多