add diag warning icon

This commit is contained in:
Matt Parker
2025-09-12 19:37:27 +10:00
parent 4ee90bff50
commit 6dbfb3a67c
2 changed files with 15 additions and 1 deletions

View File

@@ -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;
});
}