Is there an easy way to highlight or find out whic...
# getting-started
s
Is there an easy way to highlight or find out which object is being passed as the receiver in IDEA? In my usual cases I can easily have ten nested scopes
j
you can do CTRL-SHIFT-P with the caret within the block, which will give you the type of the lambda
a
but I'm not sure if it also works for
this
s
The case is something like this:
Copy code
foo { // this: Foo
bar { // this: Bar
baz { // this: Baz
moo()
}
}
}
moo()
takes something as receiver that either
Foo
,
Bar
or
Baz
satisfies. I would just like something nice like Ctrl + B for variables but since I cannot select the receiver then I cannot use that.
j
doesn’t CTRL-SHIFT-P work for you? I’d thought if you put the caret before
moo()
you’d see something like
Baz.() -> Unit
s
Yes but the receiver of moo can also be
Foo
or
Bar
. Consider
fun CharSequence.moo() {}
and
interface Foo : CharSequence