Source Auto Formatting
define format style
Main Menu -> Settings -> Editor -> Source formatter;
define shortcuts
Main Menu -> Settings -> Editor -> Keyboard shortcuts. I use "F10" as its shortcut;
formatting code
use the shortcut define in the previous step.