1

I would like to execute the "reformat code" action on the entire project automatically when I press the run button. Is there any way to do this?

  • I think there is no way to do that and makes very little sense. There is, however, that option when you commit something and that actually makes sense. – Sam Sep 01 '17 at 07:58
  • I don't want to use android studio to perform commits, I need another way to format code automatically, and I think that when I run my project is the best moment to do that. – Victor Manuel Pineda Murcia Sep 01 '17 at 08:14
  • You can reformat your entire project by selecting the project node in the Project view and then clicking on `Code > Reformat Code`. This is an on demand reformat rather than an 'automatic' one but if you reformat everytime you run your project you will (a) add time to each run and (b) the reformat may be redundant since not every run will be associated with code changes. – glytching Sep 01 '17 at 08:26

1 Answers1

4

I see two possibilities:

  1. Configure action Run and Reformat code to the same keyboard shortcut

  2. Use reformat on save.

P.S. In any project there must be a VCS. Working with it inside IDEA is really good and you should learn how to use it. There is a native reformat on commit checkbox in the commit dialog.

Sam
  • 1,832
  • 19
  • 35