Sorting behavior of the Variables Toolview
Sorting all levels of the tree creates surprising, or outright irritating, outcomes:
- "Auto" and "Locals" items swap place
- Items of collection variables get reversed, e.g. the children of a pretty-printed vector<>
- The member variables of a class are sorted alphabetically, which might be totally undesirable, e.g. the children of
struct Color { int r, g, b, a; }
will be shown as abgr or rgba depending on the sorting direction. Or, worse, a 4D vector whose components are xyzw: sorting them alphabetically make the debugging experience quite unpleasant.
I propose to rework the sorting to have the Variables Toolview behave more or less like the "Locals" window of Visual Studio. The idea is:
- Disallow sorting by clicking on column headers
- "Auto" and "Locals" are always the first and second top level items
- If present, "this" should be the first child of "Locals"
- The rest of local variables are sorted ascending and case sensitive (byte-value order could be OK)
- The children of expandable variables are not sorted and displayed as the debugger reports them