I'm using Android Studio 2.2 and I like auto-formatting my code using ctrl-alt-L. The problem, however, is that it also reorders all of my methods. (For some reason, it wants to put all of my static methods at the top of the class.) Is there a way to disable the rearranging of methods while auto-formatting?
Note: I'm guessing that I could go into Settings -> Editor -> Code Style -> Java
and under the "Arrangement" tab delete all of the "Matching rules", but there has to be a simpler way than that, no?
From IntelliJ support at Jetbrain, you can configure default behavior for "Reformat Code" action using ctrl + alt + shift + L shortcut, where you can enable/disable Rearrange code option: https://www.jetbrains.com/help/idea/2016.2/reformat-file-dialog.html.
Also, after a reformat action (i.e. ctrl + alt + L) there will be a pop-up that will say something like, "No lines changed: code is already properly formatted. Show reformat dialog: Ctrl+Alt+Shift+L". The word "Show" will be linked to the "Reformat File Dialog" which is another way to get to the dialog to enable/disable the Rearrange code option.
Arrangement behavior can be customized in File -> Settings -> Editor -> Code Style -> Java -> Arrangement
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With