We have a mixed Java / Kotlin codebase and we regularly use the IntelliJ open type (Ctr + N shortcut) to open classes in IntelliJ. This works fine for Java classes but Kotlin classes aren’t located.
The workaround is to use open resource (Ctr + Shift + N) but I regularly get complaints from users that are just starting to use Kotlin that they’re not able to locate some classes.
Would it be possible to fix this defect in IntelliJ to recognize Kotlin classes & objects (singletons) when attempting to open a type (Ctr + N)?
I’m using IntelliJ 2018.1.2
Hello, I can’t reproduce this in IDEA 2018.1/ 2018.2 with Kotlin 1.2.60. Can you please try to install the latest Kotlin plugin version and invoke “File → Invalidate caches/Restart…”. If that doesn’t help, please create a YouTrack issue and share your project (can be done privately) for us to reproduce the problem. Thank you.
@Alexey.Belkov Thanks for your response.
Digging deeper into this, it looks like Ctr + N works for Java-style Kotlin files which contain a top-level class. However, we have some Kotlin files which only contain top-level functions without any classes but these files also contain the “@file:JvmName” annotation. So from the perspective of Java developers, they are calling static functions on a class but aren’t able to navigate to that class the normal way (via Ctr + N).
Are you able to reproduce this more specific scenario?
Thank you, I reproduced the problem and created this issue, please follow it.
1 Like