This is a very simple and general rule, but several Kotlin constructions look a bit awkward when they are formatted this way. There's a nice idea to use the double indent for showing that a multi-line expression hasn't ended on the previous line. The most notable change is in the continuation indentation policy. Switch to the default formatting and make it consistent with Kotlin coding conventions in Kotlin 1.4ĭifferences between "Kotlin coding conventions" and "IntelliJ IDEA default code style" That's why we have the following migration plan instead:Įnable the official code style formatting by default starting from Kotlin 1.3 and only for new projects (old formatting can be enabled manually)Īuthors of existing projects may choose to migrate to the Kotlin coding conventionsĪuthors of existing projects may choose to explicitly declare using the old code style in a project (this way the project won't be affected by switching to the defaults in the future) Not really the expected result for plugin update, right? But this would mean that all the existing Kotlin projects will have a new code style enabled the moment the Kotlin plugin is installed. It may seem a logical next step to remove this obscurity by switching the defaults in IntelliJ IDEA and make formatting consistent with the Kotlin coding conventions. Unfortunately, the code formatter built into IntelliJ IDEA had to work long before this document was released and now has a default setup that produces different formatting from what is now recommended. Kotlin coding conventions affect several aspects of writing idiomatic Kotlin, and a set of formatting recommendations aimed at improving Kotlin code readability is among them. Migrate to Kotlin code style Kotlin coding conventions and IntelliJ IDEA formatter
0 Comments
Leave a Reply. |