“在列中对齐字段”C / C ++

问题描述 投票:2回答:2

有没有办法为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

eclipse alignment
2个回答
0
投票

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

如果我们可以使用本机eclipse格式化程序执行此操作仍然会很好。


0
投票

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

OCDFormat也不错,虽然灵活性稍差,但有一个issue with some (common) operators)。

© www.soinside.com 2019 - 2024. All rights reserved.