diff --git a/src/SharpIDE.Godot/DiAutoload.cs b/src/SharpIDE.Godot/DiAutoload.cs index f7fd0d3..c0ff9dd 100644 --- a/src/SharpIDE.Godot/DiAutoload.cs +++ b/src/SharpIDE.Godot/DiAutoload.cs @@ -13,6 +13,7 @@ using SharpIDE.Application.Features.Nuget; using SharpIDE.Application.Features.Run; using SharpIDE.Application.Features.Search; using SharpIDE.Application.Features.Testing; +using SharpIDE.Godot.Features.ActivityListener; namespace SharpIDE.Godot; @@ -48,6 +49,7 @@ public partial class DiAutoload : Node services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddHttpClient(); services.AddLogging(builder => diff --git a/src/SharpIDE.Godot/Features/ActivityListener/ActivityMonitor.cs b/src/SharpIDE.Godot/Features/ActivityListener/ActivityMonitor.cs new file mode 100644 index 0000000..77a2458 --- /dev/null +++ b/src/SharpIDE.Godot/Features/ActivityListener/ActivityMonitor.cs @@ -0,0 +1,24 @@ +using System.Diagnostics; +using SharpIDE.Application; +using SharpIDE.Application.Features.Events; + +namespace SharpIDE.Godot.Features.ActivityListener; + +public class ActivityMonitor +{ + public EventWrapper ActivityStarted { get; } = new(_ => Task.CompletedTask); + public EventWrapper ActivityStopped { get; } = new(_ => Task.CompletedTask); + + public ActivityMonitor() + { + var listener = new System.Diagnostics.ActivityListener + { + ShouldListenTo = source => source == SharpIdeOtel.Source, + Sample = (ref ActivityCreationOptions _) => ActivitySamplingResult.PropagationData, + ActivityStarted = activity => ActivityStarted.InvokeParallelFireAndForget(activity), + ActivityStopped = activity => ActivityStopped.InvokeParallelFireAndForget(activity), + }; + + ActivitySource.AddActivityListener(listener); + } +} \ No newline at end of file diff --git a/src/SharpIDE.Godot/Features/ActivityListener/ActivityMonitor.cs.uid b/src/SharpIDE.Godot/Features/ActivityListener/ActivityMonitor.cs.uid new file mode 100644 index 0000000..022c934 --- /dev/null +++ b/src/SharpIDE.Godot/Features/ActivityListener/ActivityMonitor.cs.uid @@ -0,0 +1 @@ +uid://bj7cmmfhf41ry diff --git a/src/SharpIDE.Godot/Features/BottomBar/RunningTasksDisplay.cs b/src/SharpIDE.Godot/Features/BottomBar/RunningTasksDisplay.cs new file mode 100644 index 0000000..8d5c953 --- /dev/null +++ b/src/SharpIDE.Godot/Features/BottomBar/RunningTasksDisplay.cs @@ -0,0 +1,79 @@ +using System.Diagnostics; +using Godot; +using SharpIDE.Application.Features.Analysis; +using SharpIDE.Godot.Features.ActivityListener; + +namespace SharpIDE.Godot.Features.BottomBar; + +public partial class RunningTasksDisplay : HBoxContainer +{ + [Inject] private readonly ActivityMonitor _activityMonitor = null!; + + private bool _isSolutionLoading; + private bool _isSolutionDiagnosticsBeingRetrieved; + + private Label _solutionLoadingLabel = null!; + private Label _solutionDiagnosticsLabel = null!; + + public override void _Ready() + { + _solutionLoadingLabel = GetNode