One of my favorite plugins that I constantly suggest to install is Save Actions

https://plugins.jetbrains.com/plugin/7642-save-actions

Save Actions plugin allows me to run a few code quality actions whenever a file is saved: pretty straightforward.

The configuration is accessible from Preferences -> Other Settings -> Save Actions and the default looks pretty much like this:

Every time I save I also fix the imports and the code style

This is it, really. This little trick allows you to stop thinking about unused imports or messy code formatting. Things will just fall in place when I save.

More power!

You can even try fancier stuff, tho. Save Actions is also able to run a Quick List. A Quick List can look like this:

This Quick List runs three actions:

  • Fix the imports
  • Fix the code style
  • Sort the XML alphabetically

Once you created the Quick List, you can wire it to Save Actions like this:

This is such a powerful tool to automate your most common IDE tasks and I hope it can take away a bit of stress off your daily programming work 😃

Happy coding 💪🏻