【问题标题】:Eclipse CDT formatting - wrap after operatorEclipse CDT 格式化 - 在运算符之后换行
【发布时间】:2017-12-06 23:18:42
【问题描述】:

我想知道如何在 EclipseCDT 格式化程序中实现这一点:

输入:

if ((example1 + example1 < example2) || (example3 + example4 < example5) || (example1 + example1 < example2))
{
     printf("sth");
}

预期:

if ((example1 + example1 < example2) || (example3 + example4 < example5) ||
    (example1 + example1 < example2)) 
{
   printf("sth");
}

if ((example1 + example1 < example2) || 
    (example3 + example4 < example5) ||
    (example1 + example1 < example2)) 
{
   printf("sth");
}

Eclipse 给了我这个(在运算符之前换行):

if ((example1 + example1 < example2)
   || (example3 + example4 < example5)
   || (example1 + example1 < example2))
{
    printf("sth");
}

还有另一个选项,clang-formatter,但我现在不能使用它。

【问题讨论】:

    标签: eclipse formatting code-formatting


    【解决方案1】:

    此功能在 Eclipse 的其他版本(例如标准 Java 版本)中可用,但在 Eclipse CDT 中不可用。

    Bugzilla 中打开了一个请求,如果您有兴趣将此功能添加到 CDT 产品中,您应该支持它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-05
      • 2015-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-31
      相关资源
      最近更新 更多