Inline debugger values
Hi all,
The new v14 feature to have values from the debugger displayed inline in the editor is really great. Is it possible to achieve this for other languages? I'm mostly interested in Clojure which is a JVM language - if this is possible, what is required to make it work?
Thanks,
Colin
请先登录再写评论。
Hi Colin,
inline debugger should work out of the box for your language if:
1) You already have debug support and Variables View works for your language and displays local variables when stop at a break point.
2) Navigation from Variables View works for nodes. Check it. Press F4 on a node. You should jump to the declaration. See XValue.computeSourcePosition(XNavigatable) and its implementations
Thanks Konstantin, I finally got to try this, and the problem was indeed the source positions. I added an implementation of SourcePositionProvider and it all works great! This is really great functionality.
Is there a way I can customise the values that get printed? From what I can tell, it always uses toString(). My values are JavaValues since I'm using the JVM debugger. There doesn't seem to be any way to customise JavaValuePresentation, or supply a subclass, or substitute a new value type. Can I do this?
Actually, after digging a little further, it looks like this should use NodeRenderer.calcLabel - I'll try that.
Please take a look at XValueCompactPresentation and its implementations. Hope this helps.
The only implementation of XValueCompactPresentation I can see in Community is JavaValuePresentation, and I can't customise that. But I figured out that as long as the type has a NodeRenderer implementation, its calcLabel() result is indeed shown by the EditorLinePainter. This is really nice.
One thing that would be really great would be to customise the variable names due to name munging in Clojure and other alternative JVM languages - this is the same problem as IDEA-135440 I think.
In case anyone else is interested, by implementing EditorTextProvider I also got the quick eval on Alt-click, which is great.