From c7aa30581d0bf816b91653660716fef2d18834fb Mon Sep 17 00:00:00 2001 From: Devin Bidwell Date: Wed, 24 Dec 2025 11:10:10 -0700 Subject: [PATCH] Added logging around the creation of the IC10Editor tab --- csharp_mod/Formatter.cs | 14 +++++++++++--- csharp_mod/GlobalCode.cs | 3 --- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/csharp_mod/Formatter.cs b/csharp_mod/Formatter.cs index 16f81fc..334403a 100644 --- a/csharp_mod/Formatter.cs +++ b/csharp_mod/Formatter.cs @@ -14,7 +14,7 @@ public class SlangFormatter : ICodeFormatter private CancellationTokenSource? _lspCancellationToken; private object _tokenLock = new(); - protected static Editor? Ic10Editor = null; + protected Editor? Ic10Editor = null; private IC10CodeFormatter iC10CodeFormatter = new IC10CodeFormatter(); private string ic10CompilationResult = ""; private List ic10SourceMap = new(); @@ -37,6 +37,7 @@ public class SlangFormatter : ICodeFormatter public SlangFormatter() : base() { + L.Info("Slang Constructor"); OnCodeChanged += HandleCodeChanged; OnCaretMoved += UpdateIc10Formatter; } @@ -194,13 +195,20 @@ public class SlangFormatter : ICodeFormatter private void UpdateIc10Formatter() { - if (Ic10Editor is null) + var tab = Editor.ParentTab; + if (Ic10Editor == null) { - var tab = Editor.ParentTab; + L.Info("Ic10Editor was null"); iC10CodeFormatter = new IC10CodeFormatter(); Ic10Editor = new Editor(Editor.KeyHandler); Ic10Editor.IsReadOnly = true; iC10CodeFormatter.Editor = Ic10Editor; + tab.ClearExtraEditors(); + } + + if (tab.Editors.Count < 2) + { + L.Info("Adding new editor tab"); tab.AddEditor(Ic10Editor); } diff --git a/csharp_mod/GlobalCode.cs b/csharp_mod/GlobalCode.cs index bb00095..bbe5f08 100644 --- a/csharp_mod/GlobalCode.cs +++ b/csharp_mod/GlobalCode.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.IO; -using System.IO.Compression; -using System.Text; namespace Slang;