Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pydev, auto code format all files in an eclipse project

Please suggest a way to auto format all py files in an eclipse project using pydev auto code format. We're using the pydev code formatter to make our code consistent and would really like to get all files standardized.

Since we've enabled code formatting in pydev, every time a py file is touched by pydev, it gets changed at many places only due to code formatting cleanup. We'd like to do it across the project in one sweep.

Thanks

like image 760
eskhool Avatar asked Mar 25 '12 02:03

eskhool


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.

Does Eclipse have auto format?

Importing preferences for automatic formatting. Eclipse has the capability to do so some automatic formatting whenever a file that is being edited is saved.

Does PyDev have auto indentation?

Although auto-indentation is not a feature of PyDev because of the language design you should be able to indent with a simple tab. Just select the lines you want to indent and press Tab. If you want to unindent lines you have to press Shift+Tab. Thats all.

How do I format code in Eclipse?

Eclipse has a default Java code formatting profile, known as Eclipse [built-in], which it uses to format code every time you press the combination keys Ctrl + Shift + F (on Windows) and ⌘ + ⇧ + F (on Mac).


1 Answers

You can apply code-formatting to all the files within a project/folder.

To do that, right-click a project/folder and select pydev > source format python files.

like image 83
Fabio Zadrozny Avatar answered Sep 17 '22 14:09

Fabio Zadrozny