【问题标题】:Stop Uncrustify from aligning continued multiline conditional expression停止 Uncrustify 对齐连续的多行条件表达式
【发布时间】:2017-11-19 06:20:25
【问题描述】:

我想为 Visual Studio 和 Uncrustify 设置匹配行为,以便 Uncrustify 以后不会修改即时格式。

我快到了,但 Uncrustify 处理持续的多行表达式非常好。它根据第一行对齐第二行和其他行。

我怎样才能让它在第一个之后的行上只放一个普通的哑缩进?

我在这里查看了http://uncrustify.sourceforge.net/default.cfg 的完整选项列表,但到目前为止没有成功。

去壳:

bool test(int a, int b, int c)
{
    return a == 1
           && b == 1
           && c == 1;
}

在 b 和 c 的行上存在不希望的对齐。

Visual Studio 自动套用格式:

bool test(int a, int b, int c)
{
    return a == 1
        && b == 1
        && c == 1;
}

(如果你想知道我为什么需要 Uncrustify,主要是因为 Uncrustify 有 indent_namespace_single_indent 选项,而 VS 没有)。

【问题讨论】:

    标签: autoformatting uncrustify


    【解决方案1】:

    使用此选项归档所需的行为:

    indent_single_after_return = true
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-03
      • 2016-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-24
      • 2021-06-11
      • 2021-12-03
      相关资源
      最近更新 更多