Search code examples
kotlinintellij-ideajetbrains-ide

How to navigate to a Kotlin type declaration from a variable with an inferred type in IntelliJ IDEA?


Let's say I have a code like this:

val request = buildRequest()

Problem: I want to see what the type of request is and navigate to its declaration.

I can find out the type by hovering the variable or using Ctrl+Shift+P, but I haven't found an easy way to navigate to the type itself. command + click doesn't work here.

Question: How to navigate to the type declaration of a variable whose type is inferred?


Solution

  • Have you tried using Ctrl + Shift + B keyboard shortcut?

    This tip for Windows or Linux users.

    Context menu

    Result of Type declaration choose