简体   繁体   中英

IntelliJ does not sort Kotlin imports

When writing Java code, IntelliJ automatically sorts imports by name. However, when importin members in Kotlin, they remain unsorted. Selecting Code → Optimize Imports ( Ctrl + Alt + O ) does nothing.

Here is an example:

import kotlin.platform.platformStatic
import java.text.DateFormaty
import org.hibernate.validator.constraints.NotEmpty as notEmpty
import com.fasterxml.jackson.annotation.JsonProperty as jsonProperty
import javax.validation.constraints.NotNull as notNull
import javax.validation.Valid as valid

What I'm expecting:

import com.fasterxml.jackson.annotation.JsonProperty as jsonProperty
import org.hibernate.validator.constraints.NotEmpty as notEmpty
import kotlin.platform.platformStatic
import java.text.DateFormat
import javax.validation.constraints.NotNull as notNull
import javax.validation.Valid as valid

I'm using IntelliJ 14.0.2 with the Kotlin plugin (version 0.10.195)

This has been fixed in recent versions of IntelliJ , for example the current version (at time of writing 2017.3.3)

If you only have a perpetual fallback licence for the full version of IntelliJ 14 - you could still use the community edition of a more recent version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM