From fd3e3a2afe649760a4658c4c194ffe966fb48b16 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Mon, 18 Aug 2025 21:38:22 +1000 Subject: [PATCH] refactor --- src/SharpIDE.Godot/SharpIdeCodeEdit.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/SharpIDE.Godot/SharpIdeCodeEdit.cs b/src/SharpIDE.Godot/SharpIdeCodeEdit.cs index ed035c2..f386695 100644 --- a/src/SharpIDE.Godot/SharpIdeCodeEdit.cs +++ b/src/SharpIDE.Godot/SharpIdeCodeEdit.cs @@ -36,17 +36,19 @@ public partial class SharpIdeCodeEdit : CodeEdit { _popupMenu = GetNode("CodeFixesMenu"); _popupMenu.IdPressed += OnCodeFixSelected; - this.CodeCompletionRequested += OnCodeCompletionRequested; - this.CodeFixesRequested += OnCodeFixesRequested; - this.CaretChanged += () => - { - _selectionStartCol = GetSelectionFromColumn(); - _selectionEndCol = GetSelectionToColumn(); - _currentLine = GetCaretLine(); - GD.Print($"Selection changed to line {_currentLine}, start {_selectionStartCol}, end {_selectionEndCol}"); - }; + CodeCompletionRequested += OnCodeCompletionRequested; + CodeFixesRequested += OnCodeFixesRequested; + CaretChanged += OnCaretChanged; TextChanged += OnTextChanged; - this.SyntaxHighlighter = _syntaxHighlighter; + SyntaxHighlighter = _syntaxHighlighter; + } + + private void OnCaretChanged() + { + _selectionStartCol = GetSelectionFromColumn(); + _selectionEndCol = GetSelectionToColumn(); + _currentLine = GetCaretLine(); + GD.Print($"Selection changed to line {_currentLine}, start {_selectionStartCol}, end {_selectionEndCol}"); } private void OnTextChanged()