Kotlin code auto format

Is there a way to automatically format kotlin code (e.g. fix indentation)?

IntelliJ IDEA has action for it: Code -> Reformat Code... (Ctrl+Alt+L / Cmd+Alt+L) It works not only for Kotlin, but also for any language supported by the IDE.

1 Like

10x!

But IntelliJ doesn’t work on termux on Android.
I’ve installed openjdk 9 in it.

I try to build a pre-push.sh git-hook to auto format with Android Studio, but I end up in a “only one instance of Studio can be run” when I do this CLI command and Android Studio is running.

Any clue how to get rid of it, or how can this pre-push git-hook can be done ?
Or how to connect to existing Android Studio instance and do the format with this instance ?