From e1b864cdd64ba41dec1bcd06417a62b4c22e73ae Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Wed, 17 Dec 2025 18:25:22 +1000 Subject: [PATCH] debugger variables display - icons --- .../Tab/SubTabs/ThreadsVariablesSubTab.cs | 17 +++++++++++++++++ .../Tab/SubTabs/ThreadsVariablesSubTab.tscn | 1 + 2 files changed, 18 insertions(+) diff --git a/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs b/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs index 83eb8d8..551aede 100644 --- a/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs +++ b/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs @@ -11,6 +11,10 @@ namespace SharpIDE.Godot.Features.Debug_.Tab.SubTabs; public partial class ThreadsVariablesSubTab : Control { private PackedScene _threadListItemScene = GD.Load("res://Features/Debug_/Tab/SubTabs/ThreadListItem.tscn"); + + private readonly Texture2D _fieldIcon = ResourceLoader.Load("uid://c4y7d5m4upfju"); + private readonly Texture2D _propertyIcon = ResourceLoader.Load("uid://y5pwrwwrjqmc"); + private readonly Texture2D _staticMembersIcon = ResourceLoader.Load("uid://dudntp20myuxb"); private Tree _threadsTree = null!; private Tree _stackFramesTree = null!; @@ -131,6 +135,19 @@ public partial class ThreadsVariablesSubTab : Control { var variableItem = _variablesTree.CreateItem(parentItem); variableItem.SetText(0, $$"""{{variable.Name}} = {{{variable.Type}}} {{variable.Value}}"""); + var icon = variable.PresentationHint?.Kind switch + { + VariablePresentationHint.KindValue.Data => _fieldIcon, + VariablePresentationHint.KindValue.Property => _propertyIcon, + VariablePresentationHint.KindValue.Class => _staticMembersIcon, + _ => null + }; + if (icon is null) + { + // unlike sharpdbg and presumably vsdbg, netcoredbg does not set PresentationHint for variables + if (variable.Name == "Static members") icon = _staticMembersIcon; + } + variableItem.SetIcon(0, icon); variableItem.SetMetadata(0, new Vector2I(0, variable.VariablesReference)); if (variable.VariablesReference is not 0) { diff --git a/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.tscn b/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.tscn index 574f667..6f8ad6c 100644 --- a/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.tscn +++ b/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.tscn @@ -70,6 +70,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +theme_override_constants/icon_max_width = 18 theme_override_constants/draw_guides = 0 theme_override_styles/panel = SubResource("StyleBoxEmpty_hwpe6") hide_root = true