From 1439f9ee7e65cb9b40571cd8dffbfa90914780bd Mon Sep 17 00:00:00 2001 From: Devin Bidwell Date: Fri, 19 Dec 2025 21:58:47 -0700 Subject: [PATCH] Remove conditional IC10 formatting --- csharp_mod/Formatter.cs | 35 ++++++++++++++++++----------------- rust_compiler/Cargo.lock | 2 +- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/csharp_mod/Formatter.cs b/csharp_mod/Formatter.cs index 1efae5f..55599c4 100644 --- a/csharp_mod/Formatter.cs +++ b/csharp_mod/Formatter.cs @@ -187,9 +187,12 @@ public class SlangFormatter : ICodeFormatter var caretPos = Editor.CaretPos.Line; // get the slang sourceMap at the current editor line - var lines = ic10SourceMap.FindAll(entry => - entry.SlangSource.StartLine == caretPos || entry.SlangSource.EndLine == caretPos - ); + var lines = ic10SourceMap + .FindAll(entry => + entry.SlangSource.StartLine == caretPos || entry.SlangSource.EndLine == caretPos + ) + .ConvertAll(el => el.Ic10Line) + .ToHashSet(); // extract the current "context" of the ic10 compilation. The current Slang source line // should be directly next to the compiled IC10 source line, and we should highlight the @@ -197,21 +200,19 @@ public class SlangFormatter : ICodeFormatter iC10CodeFormatter.ResetCode(ic10CompilationResult); - if (lines.Count < 1) + uint index = 0; + foreach (var line in iC10CodeFormatter.Lines) { - return; - } - - iC10CodeFormatter.Lines = new StyledText(); - - var minLine = lines.Min(map => map.Ic10Line); - var maxLine = lines.Max(map => map.Ic10Line); - - foreach (var line in lines) - { - iC10CodeFormatter - .Lines[(int)line.Ic10Line] - .ForEach(token => token.Style.Color = ColorIdentifier); + if (lines.Contains(index)) + { + index += 1; + continue; + } + line.ForEach(token => + { + token.Style.Color = ColorDefault; + }); + index += 1; } } diff --git a/rust_compiler/Cargo.lock b/rust_compiler/Cargo.lock index 4a2af3c..b13e2ce 100644 --- a/rust_compiler/Cargo.lock +++ b/rust_compiler/Cargo.lock @@ -930,7 +930,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "slang" -version = "0.3.4" +version = "0.4.0" dependencies = [ "anyhow", "clap",