Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse C++: Format Source Files in Batch

Is it possible for me to use Eclipse to mass-reformat a bunch of C++ files (on the order of a few thousands), without actually having to open every single one in the IDE?


Update:

A couple people have now posted solutions for the Java IDE, but this does not seem to work for the C++ IDE because there is no "Source" submenu in Project Explorer. :(

like image 277
user541686 Avatar asked Mar 24 '11 07:03

user541686


People also ask

How do I format all files in Eclipse?

To format your whole script: Open the required file. Go to Source | Format Document or press Ctrl+Shift+F.

How do I fix indentation in Eclipse?

You can use Ctrl + A to select the entire file, then use this shortcut to quickly fix all the indentation. You can also change how Eclipse handles indentation by going to Window > Preferences, then in the left panel, navigate to Java > Code Style > Formatter > Edit... > Indentation.


1 Answers

This feature will be arriving in the next version of CDT (due in June 2011), CDT 8 in Eclipse 3.7. You can try it now using a milestone build of the platform + cdt: http://eclipse.org/downloads/packages/release/indigo/m6

The bug where this feature was added is here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=245747

like image 156
James Blackburn Avatar answered Sep 17 '22 14:09

James Blackburn