Intellij IDEA, format all code in a project

Michael Berry picture Michael Berry · Mar 12, 2011 · Viewed 38.2k times · Source

I really like IDEA's code formatting, but how do I get it to reformat all the code in a particular project without going through each file? I've found the option to tidy / optimise imports on code before committing it to subversion which is great, but it only seems to apply to files that have otherwise been modified (which is sensible in the majority of cases!)

Is there a way to auto-format all the source files in a project without going through them all by hand?

Answer

Friesgaard picture Friesgaard · Mar 12, 2011

In the tree-structure, right click on the folder you like to reformat, choose "Reformat code" from the menu.