From eac1f59e307ceb518602f3635e537b72e04ff4a4 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Mon, 25 Aug 2025 21:38:47 +1000 Subject: [PATCH] set line background on breakpoint --- src/SharpIDE.Godot/ExampleScript.gd | 4 ++-- src/SharpIDE.Godot/IdeRoot.tscn | 1 + src/SharpIDE.Godot/SharpIdeCodeEdit.cs | 11 ++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/SharpIDE.Godot/ExampleScript.gd b/src/SharpIDE.Godot/ExampleScript.gd index 84a8df2..513218c 100644 --- a/src/SharpIDE.Godot/ExampleScript.gd +++ b/src/SharpIDE.Godot/ExampleScript.gd @@ -1,4 +1,4 @@ -extends Node2D +extends Control # Declare an empty dictionary object var game = {} @@ -12,7 +12,7 @@ func _ready(): "energy": 67 } - if game.empty(): + if game.is_empty(): # Add data to the game dictionary game["player"] = player game["score"] = 0 diff --git a/src/SharpIDE.Godot/IdeRoot.tscn b/src/SharpIDE.Godot/IdeRoot.tscn index b811b19..a803e11 100644 --- a/src/SharpIDE.Godot/IdeRoot.tscn +++ b/src/SharpIDE.Godot/IdeRoot.tscn @@ -184,6 +184,7 @@ highlight_current_line = true symbol_lookup_on_click = true symbol_tooltip_on_hover = true gutters_draw_breakpoints_gutter = true +gutters_draw_executing_lines = true gutters_draw_line_numbers = true code_completion_enabled = true auto_brace_completion_enabled = true diff --git a/src/SharpIDE.Godot/SharpIdeCodeEdit.cs b/src/SharpIDE.Godot/SharpIdeCodeEdit.cs index 25e7017..486f199 100644 --- a/src/SharpIDE.Godot/SharpIdeCodeEdit.cs +++ b/src/SharpIDE.Godot/SharpIdeCodeEdit.cs @@ -54,19 +54,20 @@ public partial class SharpIdeCodeEdit : CodeEdit { var lineInt = (int)line; var breakpointAdded = IsLineBreakpointed(lineInt); - lineInt++; // Godot is 0-indexed, Debugging is 1-indexed - Guard.Against.Negative(lineInt, nameof(lineInt)); + var lineForDebugger = lineInt + 1; // Godot is 0-indexed, Debugging is 1-indexed var breakpoints = Singletons.RunService.Breakpoints.GetOrAdd(_currentFile, []); if (breakpointAdded) { - breakpoints.Add(new Breakpoint { Line = lineInt } ); + breakpoints.Add(new Breakpoint { Line = lineForDebugger } ); + SetLineBackgroundColor(lineInt, new Color("3a2323")); } else { - var breakpoint = breakpoints.Single(b => b.Line == lineInt); + var breakpoint = breakpoints.Single(b => b.Line == lineForDebugger); breakpoints.Remove(breakpoint); + SetLineBackgroundColor(lineInt, Colors.Transparent); } - GD.Print($"Breakpoint {(breakpointAdded ? "added" : "removed")} at line {lineInt}"); + GD.Print($"Breakpoint {(breakpointAdded ? "added" : "removed")} at line {lineForDebugger}"); } private void OnSymbolLookup(string symbol, long line, long column)