Hi, I have another suggestion that I think would satisfy the requests some people have made about viewing string and array structs automatically in a specified format, without needing to specify it for every watch element (https://remedybg.handmade.network/forums/t/8165-feature_request__super_simple_custom_watches ).

The idea is that there would be another window, called something like "Struct Watch Customization", where you could add elements (like you can add elements in the Watch window). To add an element, you would type the name of your struct. Once you've added the struct, you can add items to that struct. These items are expressions, like in the Name column of the Watch window. You can add multiple of these per struct, and they get listed below it, and you can collapse and expand that name list. These expressions can use the members of the struct, and they will be added in the Watch window whenever you are watching a value that has the type of that struct. These visualizations could be arrays, just a numerical value, like important data about your struct that you might not keep in memory to reduce memory impact, like the area of a triangle. These struct visualizations could also be collapsed in the Watch window. And they could also contain more visualizations inside, recursively.

So, that window might look like this:

Struct Watch Customization Window:
 string    <-- (if you hover on the struct name it shows its members)
 |- base, str size   <-- (this is the expression)
 |- size   <-- (another expression)

Then in the Watch window, every string would be expandable, showing their 2 member variables, and it would now also show a 3rd and a 4th item which would be these two expressions. Some visual element should differentiate member variables and expressions.

Also, you could use local variables in the struct expressions, and those expressions would only work when the mentioned variables are found. If a name in the expression exists in both the struct members and the local variables, the struct member is prioritized. To refer to a local variable in that case, there could be some special syntax to differentiate, but I think the current syntax is already enough: you could use the {n} scope syntax and __locals. For example, if there was a struct with members A,B,C, and you had variables C and D in your local scope, and you wanted to visualize the struct's A plus B, plus the locals C plus D, you could do {*} a + b + __locals.c + d (using __locals with {n} already works in the current expressions).

This would allow:

  • (nested) visualization of linked structures where the pointers to nodes are relative, and so you need to add "base + relative_pointer" to find the next node.
  • custom strings and arrays.
  • seeing the data you care about, when the data in memory might be compressed in different ways (like if you stored a grid position as y*width + x, you could see it as x, y).
  • visualizing all structs of a type with a specific advanced watch window (when those are made), e.g. being able to visualize the direction of any v2 in just one click, or to see the color of a v4.
  • etc.

Oh, and there should be a ON/OFF button on each struct expression (in the "Struct Watch Customization" window) to hide them without deleting them.

And maybe there could be another option to hide the members list when there are custom struct expressions...

Aaand it'd be cool if you could also see these when hovering in the text editor, too. That would be EPIC.

(EDIT: Removed some stuff that was stupid and added example)