Is there any way to navigate to a type declaration...
# intellij
w
Is there any way to navigate to a type declaration of a generic parameter? Right now
Copy code
val foo: Foo = createFoo()
with caret somewhere in
createFoo
, pressing
cmd + shift + b
will navigate to
Foo
. Nice 👍 What I want is with:
Copy code
val foo: Flow<Foo> = createFooFlow()
with caret somewhere inside
createFooFlow
to navigate to the generic parameter,
Foo
, instead of
Flow
. Is there a shortcut for this, or any other way to easily navigate to
Foo
?
👀 1
j
I guess you are asking this because you are inferring the type? I haven't tried, but if type hints are not clickable, this can be a feature request
w
Yes exactly, I added types in the examples for clarity. I found myself navigating to wrapped types more and more often and hoped there’s a shortcut or some trick available
👍 1
Related but not quite https://youtrack.jetbrains.com/issue/KT-38172 I opened https://youtrack.jetbrains.com/issue/KT-46116 but I forgot there’s
KTIJ
project, oh well
s
Well, technically there isnt "the" generic parameter so there is the question of what happens in the multiple case.
w
Yeah, I’m aware it’s not that simple. A dropdown would be reasonable I suppose
u
And what about nested type parameters? <String, Array<List<String>>>? I’d say an expandable dropdown could solve that:
Copy code
+---------------+
| String        |
+---------------+
| Array       ->|
+---------------+