From 6dbfb3a67c56d38593dab4ea7bf87e0a589e40cc Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Fri, 12 Sep 2025 19:37:27 +1000 Subject: [PATCH] add diag warning icon --- src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs | 11 +++++++++++ .../Features/Problems/ProblemsPanel.tscn | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs index 175fc5f..186fb20 100644 --- a/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs +++ b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs @@ -9,6 +9,11 @@ namespace SharpIDE.Godot.Features.Problems; public partial class ProblemsPanel : Control { + [Export] + public Texture2D WarningIcon { get; set; } = null!; + [Export] + public Texture2D ErrorIcon { get; set; } = null!; + public SharpIdeSolutionModel? Solution { get; set; } private Tree _tree = null!; @@ -75,6 +80,12 @@ public partial class ProblemsPanel : Control { var diagItem = tree.CreateItem(parent); diagItem.SetText(0, e.NewItem.Value.GetMessage()); + diagItem.SetIcon(0, e.NewItem.Value.Severity switch + { + DiagnosticSeverity.Error => ErrorIcon, + DiagnosticSeverity.Warning => WarningIcon, + _ => null + }); e.NewItem.View.Value = diagItem; }); } diff --git a/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn index 953e384..efe4d30 100644 --- a/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn +++ b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=2 format=3 uid="uid://tqpmww430cor"] +[gd_scene load_steps=3 format=3 uid="uid://tqpmww430cor"] [ext_resource type="Script" uid="uid://b1r3no4u3khik" path="res://Features/Problems/ProblemsPanel.cs" id="1_bnenc"] +[ext_resource type="Texture2D" uid="uid://pd3h5qfjn8pb" path="res://Features/Problems/Resources/Warning.svg" id="2_xj8le"] [node name="ProblemsPanel" type="Control"] layout_mode = 3 @@ -10,6 +11,8 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_bnenc") +WarningIcon = ExtResource("2_xj8le") +ErrorIcon = ExtResource("2_xj8le") [node name="ScrollContainer" type="ScrollContainer" parent="."] layout_mode = 1