Is there any debug feature to see the content of a...
# intellij
h
Is there any debug feature to see the content of a list, like the Java stream debugger? In Kotlin, you often just chain list operations instead creating a new variable each time:
Copy code
val s = listOf().map {}.filter {}.map{}...
k
Also interested. I always do:
Copy code
val s = listOf()
  .also { println(it) }
  .map { ... }
  .also { println(it) }
  ...
h
Yes, but you need to add these println lines and this isn't a real debugging experience with breakpoints and runtime code evaluation 😄
k
Yup. That’s why I’m interested if there’s a native debugging feature!
x
To see the whole output of a collection operation, you can put the operations on separate lines and put a breakpoint on each of them. To dig into the calculations of each collection operation, you can use lambda breakpoints (as the one seen in the screenshot)
h
And it also does not work for Java source files in a Kotlin project. At least the icon is grey out.
x
Oh, I see. I haven’t seen any feature similar to that for Kotlin collections. Seems like a nice feature-request if not yet submitted. I did a quick search and I didn’t find any ticket for that
h
Hm, after digging YouTrack too, there is an issue about a bug in kotlin.sequences: https://youtrack.jetbrains.com/issue/KTIJ-12019/Connecting-lines-are-absent-for-last-element-in-windowed-operation-column-in-sequence-debugger and I get this nice debugger window too. Ideally, it should just work with lists/collections too, will create a ticket.
💯 1
x
Super cool to know about this stuff, thanks for sharing! I don't feel like this feature is widely known by IntelliJ users
plus one 1