0

I followed this post Intellij reformat on file save and set macro to do 'organize import', 'reformat code' and 'save all'. But the macro fails to do organize import and reformat code for all the saved files and formats only the current file where save (mapped to Ctrl + S) is executed

I am using IntelliJ 13.1.5

Community
  • 1
  • 1
John Jai
  • 3,463
  • 6
  • 25
  • 32

1 Answers1

1

Unfortunately, it's not possible to run "Reformat Code" or "Organize Imports" in this way.

For example, open "Preferences"* and ensure that both "Show 'Reformat Code' dialog" and "Show 'Optimize Imports' dialog" are checked.

enter image description here

Then, running either "Reformat Code" or "Optimize Imports" produces a dialog like this:

enter image description here

Notice how the "File" is the current file and the "directory" is the current directory. There is no option for "all open files" or "all project files" or anything similar.

* These images are from IntelliJ 14, but 13 should be similar.

kuporific
  • 10,053
  • 3
  • 42
  • 46