Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't rearrange code work in Kotlin files in Intellij?

I love Jetbrain's Idea IDE and its ergonomics. One of my favorite tools is idea's rearrange code 'action'(you can bring it up by hitting ctrl+shift+a). It rearranges the code in the java file to put methods in alphabetical order and order the fields in an organized fashion that the user defines. For whatever reason, it doesn't work with Jetbrain's own language, kotlin :(. This sucks even more with the fact that kotlin quickfixes the fields right above the method instead of the beginning of the file like most java files. When is Idea going to support rearrange code for kotlin files?

like image 234
Simon Theodore Avatar asked Nov 21 '16 03:11

Simon Theodore


1 Answers

The reason why the feature does not work is simple: because it has not been implemented. IntelliJ's current Java support feature set has been developed over more than 15 years, and replicating all of Java support features in a new language plugin takes time. We're prioritizing features in the Kotlin plugin for IntelliJ IDEA based on user feedback and language evolution requirements, and so far we haven't seen an indication that code rearranging is in high demand.

Specifically the issue of placing properties by the Create from Usage fix can be fixed with relatively little effort, and doesn't require a full rearrange implementation. I've filed an issue for it.

like image 131
yole Avatar answered Sep 18 '22 12:09

yole