From 9b506cd48ba8e6417ad4e1cb77f0b7ac6439cb34 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Mon, 25 Aug 2025 22:37:10 +1000 Subject: [PATCH] set line color method --- src/SharpIDE.Godot/SharpIdeCodeEdit.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/SharpIDE.Godot/SharpIdeCodeEdit.cs b/src/SharpIDE.Godot/SharpIdeCodeEdit.cs index 5a931a0..fc77fd9 100644 --- a/src/SharpIDE.Godot/SharpIdeCodeEdit.cs +++ b/src/SharpIDE.Godot/SharpIdeCodeEdit.cs @@ -76,14 +76,13 @@ public partial class SharpIdeCodeEdit : CodeEdit if (breakpointAdded) { breakpoints.Add(new Breakpoint { Line = lineForDebugger } ); - SetLineBackgroundColor(lineInt, new Color("3a2323")); } else { var breakpoint = breakpoints.Single(b => b.Line == lineForDebugger); breakpoints.Remove(breakpoint); - SetLineBackgroundColor(lineInt, Colors.Transparent); } + SetLineColour(lineInt); GD.Print($"Breakpoint {(breakpointAdded ? "added" : "removed")} at line {lineForDebugger}"); } @@ -249,12 +248,30 @@ public partial class SharpIdeCodeEdit : CodeEdit private void SendDebuggerStepOver() { if (_executionStopInfo is null) return; + var godotLine = _executionStopInfo.Line - 1; + SetLineAsExecuting(godotLine, false); + SetLineColour(godotLine); _ = GodotTask.Run(async () => { await Singletons.RunService.SendDebuggerStepOver(_executionStopInfo.ThreadId); }); } + private readonly Color _breakpointLineColor = new Color("3a2323"); + private readonly Color _executingLineColor = new Color("665001"); + private void SetLineColour(int line) + { + var breakpointed = IsLineBreakpointed(line); + var executing = IsLineExecuting(line); + var lineColour = (breakpointed, executing) switch + { + (_, true) => _executingLineColor, + (true, false) => _breakpointLineColor, + (false, false) => Colors.Transparent + }; + SetLineBackgroundColor(line, lineColour); + } + private void SetDiagnosticsModel(ImmutableArray<(FileLinePositionSpan fileSpan, Diagnostic diagnostic)> diagnostics) { _diagnostics = diagnostics;