Problem in Kotlin when importing a class


#1

Hello,

I’m pretty new in Kotlin and IntelliJ and facing some strange behaviour in the IDE.

Whenever I try to use a new class in which the first part of the package name is the same as a variable the IDE wont create the proper import statement.

For Example: I have a small Project with several packages one path might be:

src/network/synapse/SynapseType.kt

in my main function my i type something like this :

val network = BasicNetwork();
SynapseType

When I’m using the autocomplete function on SynapseType it inserts:

network.synapse.SynapseType

instead of the expected

import network.synapse.SynapseType

I’m using

Windows 10,
IntelliJ IDEA 2017.2.6 Build #IU-172.4574.11,
JRE: 1.8.0_152-release-915-b12 amd64

with Kotlin Plugin Version: 1.1.60-release-IJ2017.2-1

Hopefully someone can help me with this issue.

Best regards,

Tim


#2

Yeah, it’s a known issue and indeed is quite annoying: https://youtrack.jetbrains.com/issue/KT-10340