How can I navigate to the “actual” class when Find...
# intellij
s
How can I navigate to the “actual” class when Find usages navigates me to the expected class? My specific example is with
kotlin.collections.LinkedHashMap
, and I would like to see how the functions are actually implemented for my platform, but I can’t find a way to do that in the IDE. Any help?
o
Seems that the IDE does not offer actual navigation for library classes. You could use a local copy of the
JetBrains/kotlin
repository with the IDE, of which stdlib is a part. Therein navigation from expect to actual works as usual. The project is quite big, requires setting up environment variables and takes a while to build and index though. On the JVM side, you'll find the collections below while there are complete Kotlin implementations for JS.
Copy code
@SinceKotlin("1.1") public actual typealias ArrayList<E> = java.util.ArrayList<E>
@SinceKotlin("1.1") public actual typealias LinkedHashMap<K, V> = java.util.LinkedHashMap<K, V>
@SinceKotlin("1.1") public actual typealias HashMap<K, V> = java.util.HashMap<K, V>
@SinceKotlin("1.1") public actual typealias LinkedHashSet<E> = java.util.LinkedHashSet<E>
@SinceKotlin("1.1") public actual typealias HashSet<E> = java.util.HashSet<E>
s
Interesting, I don’t think I want to go through the process of setting it up locally, it sounds like a lengthy process. But thank you a lot, I do hope it gets better integrated into the IDE at some point in the far future.
o
The lengthy part is waiting for Gradle to set up the project and download dependencies. The ReadMe explains the Build environment requirements. Once these have been set up properly, everything should work smoothly.
🎉 1