2

Is there a way to configure Eclipse code formatter for C/C++ to Align fields in columns

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

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

For Java I found this Eclipse: Auto-align "=" in assignments

1

2 Answers 2

0

I tried with OCDFormat.jar as described at https://stackoverflow.com/a/18491579, and it works for C++ too.

It would be still nice if we can do this with native eclipse formatter.

1
0

The Eclipse plugin columns4eclipse should do the trick (gratis, open source, I use it with Eclipse 4.3 x64 and 4.5 x64 on Windows 7). It is not language-dependent.

(OCDFormat is ok too though a bit less flexible and there is an issue with some (common) operators).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.