Add a collection formatter
When inspecting a Scala (or Java) collection in the debugger, it would be very useful to see its elements as if it was an array (or rather a lazy array).
The end result should look like this:
myList: List[Int]
size: 13
elems
0: "foo"
1: "bar"
...
10: "fizz"
load more:
11: "buzz"
12: "bazz"
We can find some inspiration of how to do it in IntelliJ Scala debugger.
Corresponding feature request in Metals is: https://github.com/scalameta/metals-feature-requests/issues/307
Any pointers on roughly where in the code this sort of thing might go?
I was recently bitten by the fact that the default toString formatting of values means that very large collections will force rendering into a string when you go to poke them in the debugger (alternately, is there a way to avoid trigger toString?)
Any pointers on roughly where in the code this sort of thing might go?
That's a bit tricky because we depend on microsoft/java-debug. So first we should check if such thing is implemented in there, and then, if we can extend its implementation for our own collection classes.
The first step would be to debug a Java program in VSCode using the official Java extensions and see if it uses custom formatting for collections. Then to find where it is implemented in microsoft/java-debug.
Oh does the toString functionality originate in java-debug?
Oh does the toString functionality originate in java-debug?
Yes I am pretty sure it does.