From 5eac3ce4457b28e3be3d4f08968085a87c7d72d4 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Sun, 14 Dec 2025 19:11:55 +1000 Subject: [PATCH] clear debug panel trees on debugger continue --- .../Features/Debugging/DebuggingService.cs | 4 ++++ src/SharpIDE.Application/Features/Events/GlobalEvents.cs | 1 + .../Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs | 8 +++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs b/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs index 25cb8a5..eb04310 100644 --- a/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs +++ b/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs @@ -171,24 +171,28 @@ public class DebuggingService { await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding); var nextRequest = new NextRequest(threadId); + GlobalEvents.Instance.DebuggerExecutionContinued.InvokeParallelFireAndForget(); _debugProtocolHost.SendRequestSync(nextRequest); } public async Task StepInto(int threadId, CancellationToken cancellationToken) { await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding); var stepInRequest = new StepInRequest(threadId); + GlobalEvents.Instance.DebuggerExecutionContinued.InvokeParallelFireAndForget(); _debugProtocolHost.SendRequestSync(stepInRequest); } public async Task StepOut(int threadId, CancellationToken cancellationToken) { await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding); var stepOutRequest = new StepOutRequest(threadId); + GlobalEvents.Instance.DebuggerExecutionContinued.InvokeParallelFireAndForget(); _debugProtocolHost.SendRequestSync(stepOutRequest); } public async Task Continue(int threadId, CancellationToken cancellationToken) { await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding); var continueRequest = new ContinueRequest(threadId); + GlobalEvents.Instance.DebuggerExecutionContinued.InvokeParallelFireAndForget(); _debugProtocolHost.SendRequestSync(continueRequest); } diff --git a/src/SharpIDE.Application/Features/Events/GlobalEvents.cs b/src/SharpIDE.Application/Features/Events/GlobalEvents.cs index 64c5274..5d92937 100644 --- a/src/SharpIDE.Application/Features/Events/GlobalEvents.cs +++ b/src/SharpIDE.Application/Features/Events/GlobalEvents.cs @@ -15,6 +15,7 @@ public class GlobalEvents public EventWrapper ProjectStartedRunning { get; } = new(_ => Task.CompletedTask); public EventWrapper ProjectStoppedRunning { get; } = new(_ => Task.CompletedTask); public EventWrapper DebuggerExecutionStopped { get; } = new(_ => Task.CompletedTask); + public EventWrapper DebuggerExecutionContinued { get; } = new(() => Task.CompletedTask); /// A document changed, project was reloaded etc. Document changes include unsaved changes in the IDE. public EventWrapper SolutionAltered { get; } = new(() => Task.CompletedTask); diff --git a/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs b/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs index e3414fd..83eb8d8 100644 --- a/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs +++ b/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs @@ -27,10 +27,11 @@ public partial class ThreadsVariablesSubTab : Control _stackFramesTree = GetNode("%StackFramesTree"); _variablesTree = GetNode("%VariablesTree"); GlobalEvents.Instance.DebuggerExecutionStopped.Subscribe(OnDebuggerExecutionStopped); + GlobalEvents.Instance.DebuggerExecutionContinued.Subscribe(ClearAllTrees); _threadsTree.ItemSelected += OnThreadSelected; _stackFramesTree.ItemSelected += OnStackFrameSelected; _variablesTree.ItemCollapsed += OnVariablesItemExpandedOrCollapsed; - Project.ProjectStoppedRunning.Subscribe(ProjectStoppedRunning); + Project.ProjectStoppedRunning.Subscribe(ClearAllTrees); } private void OnVariablesItemExpandedOrCollapsed(TreeItem item) @@ -64,10 +65,11 @@ public partial class ThreadsVariablesSubTab : Control public override void _ExitTree() { GlobalEvents.Instance.DebuggerExecutionStopped.Unsubscribe(OnDebuggerExecutionStopped); - Project.ProjectStoppedRunning.Unsubscribe(ProjectStoppedRunning); + GlobalEvents.Instance.DebuggerExecutionContinued.Unsubscribe(ClearAllTrees); + Project.ProjectStoppedRunning.Unsubscribe(ClearAllTrees); } - private async Task ProjectStoppedRunning() + private async Task ClearAllTrees() { await this.InvokeAsync(() => {