Stefan Glienke 2002 Posted March 31, 2021 I know how to write a debugger visualizer and how to use the IOTADebuggerVisualizerValueReplacer. What I want to achieve is creating sub nodes with values like you get when you have a dynamic array, a record or an object. However the mentioned interface only provides a method to produce a string which is printed but no way to produce some kind of sub structure. I also know about IOTADebuggerVisualizerExternalViewer as being used for TStrings where you can click on the magnifier icon to open up another window but that is not what I would like to have. I am looking for a way to dynamically create sub entries for some type which seems to be beyond the capabilities of the ToolsAPI. But we have some people that know a bit about the internals of the IDE any maybe someone is able to find a way to achieve this. To illustrate this. uses System.Generics.Collections, Spring.Collections; procedure Main; var arr: TArray<Integer>; listA: TList<Integer>; listB: IList<Integer>; begin arr := [1, 2, 3]; listA := TList<Integer>.Create; listA.AddRange(arr); listB := TCollections.CreateList<Integer>(arr); end; I get this in the local variables view (this is from 10.4.2 where visualizers for TList<T> and alike were added): When the debugger sees a dynamic array type it shows the elements as sub nodes - thus you can "cheat" the watches: So what I would like to see is the expand icon on my listB and then the elements in the list in sub nodes just like in dynamic array. Share this post Link to post
balabuev 102 Posted March 31, 2021 Never tried it myself, but I suspect that you just need to return a string with specific format. Such as "(3, 5, 7)" to show value as array with child elements. Or like "(PropA: 3; PropB: 5)" to show as object with child properties. I may be wrong, of course. Do you looked at the source code of TDebuggerListHelperVisualizer.GetReplacementValue? Share this post Link to post
balabuev 102 Posted March 31, 2021 (edited) Also, I've noticed that the strings are different in code editor drop-down and in local variables view: String in code editor drop-down seems to be more complete (like it should be returned from GetReplacementValue). While the string in local variables view seems to be already processed by IDE. Edited March 31, 2021 by balabuev Share this post Link to post