display threads at stop point

This commit is contained in:
Matt Parker
2025-08-29 21:39:17 +10:00
parent a7e05f6ebb
commit bb6d2796ca
9 changed files with 124 additions and 25 deletions

View File

@@ -1,13 +1,38 @@
using Godot;
using SharpIDE.Application.Features.Debugging;
using SharpIDE.Application.Features.Events;
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
namespace SharpIDE.Godot.Features.Debug_.Tab.SubTabs;
public partial class ThreadsVariablesSubTab : Control
{
private VBoxContainer _threadsVboxContainer = null!;
private PackedScene _threadListItemScene = GD.Load<PackedScene>("res://Features/Debug_/Tab/SubTabs/ThreadListItem.tscn");
private VBoxContainer _threadsVboxContainer = null!;
public SharpIdeProjectModel Project { get; set; } = null!;
public override void _Ready()
{
_threadsVboxContainer = GetNode<VBoxContainer>("%ThreadsPanel/VBoxContainer");
}
public override void _Ready()
{
_threadsVboxContainer = GetNode<VBoxContainer>("%ThreadsPanel/VBoxContainer");
GlobalEvents.DebuggerExecutionStopped += OnDebuggerExecutionStopped;
}
private async Task OnDebuggerExecutionStopped(ExecutionStopInfo arg)
{
var result = await Singletons.RunService.GetInfoAtStopPoint();
var scenes = result.Threads.Select(s =>
{
var threadListItem = _threadListItemScene.Instantiate<Control>();
threadListItem.GetNode<Label>("Label").Text = $"{s.Id}: {s.Name}";
return threadListItem;
}).ToList();
await this.InvokeAsync(() =>
{
foreach (var scene in scenes)
{
_threadsVboxContainer.AddChild(scene);
}
});
}
}