简体   繁体   English

Uncrustify:嵌套块indeting是错误的

[英]Uncrustify: nested block indeting is wrong

I have this code: 我有这个代码:

dispatch_async(dispatch_get_main_queue(), ^{
    if (self.adAppearBlockIsAnimated) {
        [UIView animateWithDuration:kAnimationTime animations:^{
            self.adAppearBlock();
        }];
    }
});

Unfortunately, Uncrustify makes it look like: 不幸的是,Uncrustify让它看起来像:

dispatch_async(dispatch_get_main_queue(), ^{
    if (self.adAppearBlockIsAnimated) {
        [UIView animateWithDuration:kAnimationTime animations:^{
                self.adAppearBlock();
            }];
    }
});

My config: 我的配置:

indent_oc_block=true
indent_oc_block_msg = 0

Does anyone know how to make it look normal? 有谁知道如何使它看起来正常吗? Without extra spaces in nested block. 嵌套块中没有额外的空格。

EDIT: I cannot comment now, I am using xCode. 编辑:我现在无法发表评论,我正在使用xCode。

It appears that this a bug in Uncrustify itself; 看来这是Uncrustify本身的一个错误; you can't necessarily work around it with a config change. 你不一定能通过配置更改来解决它。

See: 看到:

https://github.com/bengardner/uncrustify/issues/68 https://github.com/bengardner/uncrustify/issues/68

(Personally, I'm a big fan of turning on "tab always indents", then selecting all, hitting and living with whatever Xcode produces. By having a standard set of formatting defaults for our team, anyone on the team can do this and not generate a bunch of spurious diffs when committing code.) (就个人而言,我很喜欢打开“tab always indents”,然后选择所有,使用Xcode生成的任何内容和生活。通过为我们的团队设置一组标准格式默认值,团队中的任何人都可以执行此操作提交代码时不会产生一堆虚假的差异。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM