debugger improvement

hi there,

i'd like to contribute a feature:
the debugger should be able to show collections in an easily readable way, just like it works for java collections. my idea was to call "toArray" on all collections which support a side effect free toArray (which should be everything except stream and iterator) and use a "toArray-as-far-as-already-evaluated"-approach on streams. since the debugger now supports scala expressions, this should be possible.
can someone point me in the right direction? could this be done completely with customized views that are already supported?

Comment actions Permalink

I'm planning to do it soon. However you also can try to do it. See com.intellij.debugger.settings.NodeRendererSettings#addPluginRenderer (should be registered from some PersistentStateComponont on Application level). Also there are possibility to add renderer, which can be enabled/disabled throught UI: com.intellij.debugger.settings.RendererConfiguration#addRenderer.

Best regards,
Alexander Podkhalyuzin.

Comment actions Permalink

i'll take a look this weekend.

Comment actions Permalink

i took a look. i'll try to reverse engineer how everything works and see if i can get a prototype running.
a few questions:
the debugger views are based on com-sun.jdi.*-interfaces. i can test if i got a classtype, look at all its interfaces and see if "gentraversablelike" is there. i'm doing this now and it works, but i'd prefer to do:
is this possible?

i check if the node is expandable by checking the size of the collection by calling "length" on it. works :)

next, i'd like to invoke "toArray" as if it was entered in the "evaluate expression" dialog to avoid specialized implementations and implicit fiddling for scala collections. how can i do this? i found the method "evalResult" in "ScalaDebuggerTestCase" which is almost what i need. how i can tell the evaluator that i want to call "toArray" on something that i got an objectreferenceimpl of? the test implementation takes a simple string, some other methods which could do it want a psielement. i need something which takes an objectreference and a string ("this.toArray")


Please sign in to leave a comment.