6 Commits

Author SHA1 Message Date
9b8900d7a7 Merge pull request 'ic10editor-update' (#4) from ic10editor-update into master
All checks were successful
CI/CD Pipeline / test (push) Successful in 33s
CI/CD Pipeline / build (push) Successful in 1m43s
CI/CD Pipeline / release (push) Successful in 5s
Reviewed-on: #4
2025-12-24 12:41:00 -07:00
792bba4875 Removed unused macro imports as they are implicit
All checks were successful
CI/CD Pipeline / test (pull_request) Successful in 33s
CI/CD Pipeline / build (pull_request) Has been skipped
CI/CD Pipeline / release (pull_request) Has been skipped
2025-12-24 12:39:21 -07:00
1c39e146fb Clear editor selection for IC10 if no slang source maps to an IC10 source
All checks were successful
CI/CD Pipeline / test (pull_request) Successful in 34s
CI/CD Pipeline / build (pull_request) Has been skipped
CI/CD Pipeline / release (pull_request) Has been skipped
2025-12-24 12:36:33 -07:00
47bcd0be34 Cleaned up BepInEx logging
All checks were successful
CI/CD Pipeline / test (pull_request) Successful in 34s
CI/CD Pipeline / build (pull_request) Has been skipped
CI/CD Pipeline / release (pull_request) Has been skipped
2025-12-24 12:10:11 -07:00
445f731170 Fixed IC10 ouput window, refactored IC10 highlighting
All checks were successful
CI/CD Pipeline / test (pull_request) Successful in 33s
CI/CD Pipeline / build (pull_request) Has been skipped
CI/CD Pipeline / release (pull_request) Has been skipped
2025-12-24 12:08:17 -07:00
c7aa30581d Added logging around the creation of the IC10Editor tab
All checks were successful
CI/CD Pipeline / test (pull_request) Successful in 34s
CI/CD Pipeline / build (pull_request) Has been skipped
CI/CD Pipeline / release (pull_request) Has been skipped
2025-12-24 11:10:10 -07:00
9 changed files with 19 additions and 32 deletions

View File

@@ -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<SourceMapEntry> ic10SourceMap = new();
@@ -193,14 +193,18 @@ public class SlangFormatter : ICodeFormatter
}
private void UpdateIc10Formatter()
{
if (Ic10Editor is null)
{
var tab = Editor.ParentTab;
if (Ic10Editor == null)
{
iC10CodeFormatter = new IC10CodeFormatter();
Ic10Editor = new Editor(Editor.KeyHandler);
Ic10Editor.IsReadOnly = true;
iC10CodeFormatter.Editor = Ic10Editor;
}
if (tab.Editors.Count < 2)
{
tab.AddEditor(Ic10Editor);
}
@@ -219,33 +223,26 @@ public class SlangFormatter : ICodeFormatter
if (lines.Count() < 1)
{
Ic10Editor.Selection = new TextRange
{
End = new TextPosition { Col = 0, Line = 0 },
Start = new TextPosition { Col = 0, Line = 0 },
};
return;
}
// get the total range of the IC10 source for the selected Slang line
var max = lines.Max(line => line.Ic10Line);
var min = lines.Min(line => line.Ic10Line);
Ic10Editor.CaretPos = new TextPosition { Col = 0, Line = (int)max };
// highlight all the IC10 lines that are within the specified range
foreach (var index in Enumerable.Range((int)min, (int)(max - min) + 1))
Ic10Editor.Selection.Start = new TextPosition { Col = 0, Line = (int)min };
Ic10Editor.Selection.End = new TextPosition
{
var lineText = Ic10Editor.Lines[index].Text;
var newLine = new StyledLine(
lineText,
[
new SemanticToken
{
Column = 0,
Length = lineText.Length,
Line = index,
Background = ColorIdentifier,
Color = ColorFromHTML("black"),
},
]
);
Ic10Editor.Lines[index] = newLine;
}
Col = Ic10Editor.Lines[(int)max].Text.Length,
Line = (int)max,
};
}
// This runs on the Main Thread

View File

@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
namespace Slang;

View File

@@ -1,4 +1,3 @@
use crate::compile;
use anyhow::Result;
use indoc::indoc;
use pretty_assertions::assert_eq;

View File

@@ -1,4 +1,3 @@
use crate::compile;
use indoc::indoc;
use pretty_assertions::assert_eq;

View File

@@ -1,4 +1,3 @@
use crate::compile;
use indoc::indoc;
use pretty_assertions::assert_eq;

View File

@@ -1,4 +1,3 @@
use crate::compile;
use indoc::indoc;
use pretty_assertions::assert_eq;

View File

@@ -1,4 +1,3 @@
use crate::compile;
use indoc::indoc;
use pretty_assertions::assert_eq;

View File

@@ -1,4 +1,3 @@
use crate::compile;
use anyhow::Result;
use indoc::indoc;
use pretty_assertions::assert_eq;

View File

@@ -1,4 +1,3 @@
use crate::compile;
use indoc::indoc;
use pretty_assertions::assert_eq;