【问题标题】:"Align Field in Columns" C/C++“在列中对齐字段”C/C++
【发布时间】:2015-07-18 04:59:18
【问题描述】:

有没有办法为 C/C++ 配置 Eclipse 代码格式化程序以对齐列中的字段

//without formatting
int mRect = 0;
int mSquare = 0;
bool isTriangle = false;

//to look like this???
int  mRect      = 0;
int  mSquare    = 0;
bool isTriangle = false;

对于 Java,我发现了这个 Eclipse: Auto-align "=" in assignments

【问题讨论】:

  • 我回答了你的问题,但我的回答被删除了。看到这个meta post

标签: eclipse alignment


【解决方案1】:

我尝试使用 https://stackoverflow.com/a/18491579 中描述的 OCDFormat.jar,它也适用于 C++。

如果我们可以使用原生 eclipse 格式化程序来做到这一点,那就太好了。

【讨论】:

【解决方案2】:

Eclipse 插件 columns4eclipse 应该可以解决问题(免费,开源,我在 Windows 7 上将它与 Eclipse 4.3 x64 和 4.5 x64 一起使用)。它不依赖于语言。

OCDFormat 也可以,但灵活性稍差,还有issue with some (common) operators)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多