How do I step into a lambda without using breakpoints?

One serious pain point I’m having with Kotlin right now is that I can’t step into lambdas without creating breakpoints all the time. This is fine in simple code but in more complex situations it becomes real tedious.

Stepping over doesn’t work, stepping into doesn’t work, smart stepping into doesn’t work. Only creating a breakpoint works which is frustrating.

Please see my example video (1 min long) to see that above situations doesn’t work like I would like:

How am I supposed to do it? What am I doing wrong?

This isn’t very helpful, but I don’t get such behavior. I tested this with the following code:

fun main() {
    doSomething {

inline fun doSomething(onSuccess: () -> Unit) {

Subsequent steps with F7 are: doSomething {onSuccess()println("success").

I added kotlin-test-junit5 dependency and used assertThrows { } and it also worked as expected. I had to perform “step into” 3-5 times to get to the lambda, but the code I traversed really looked like the code inside assertThrows().

It looks to me like mockk is messing something and this is why you get such strange results.

1 Like

It’s apparently a known issue. Some improvements will be made in 2021.3. I got this response from JetBrains Support:

Alexey Belkov (IntelliJ)

Jul 26, 2021, 13:14 GMT+2

Thanks for the feedback. Lambda stepping is a known issue: Currently we’re working on general stepping issues around lambdas and inline functions, improvements are expected to be released in Intellij IDEA 2021.3 later this year:{IDE.%20Debugger}%20%23fixed%20Target%20versions:%202021.3

1 Like