Remove references to Unitask and Cysharp

This commit is contained in:
2025-12-07 23:00:45 -07:00
parent fdd1a311d5
commit f38c15da9c
6 changed files with 28 additions and 25 deletions

5
Changelog.md Normal file
View File

@@ -0,0 +1,5 @@
# Changelog
[0.1.2]
- Removed references to `Unitask`

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ModMetadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ModMetadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>StationeersSlang</Name> <Name>Slang</Name>
<Author>JoeDiertay</Author> <Author>JoeDiertay</Author>
<Version>0.1.1</Version> <Version>0.1.2</Version>
<Description> <Description>
[h1]Slang: High-Level Programming for Stationeers[/h1] [h1]Slang: High-Level Programming for Stationeers[/h1]

View File

@@ -4,7 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using Cysharp.Threading.Tasks; using System.Threading.Tasks;
using StationeersIC10Editor; using StationeersIC10Editor;
public class SlangFormatter : ICodeFormatter public class SlangFormatter : ICodeFormatter
@@ -98,29 +98,32 @@ public class SlangFormatter : ICodeFormatter
inputSrc = this.RawText; inputSrc = this.RawText;
} }
HandleLsp(inputSrc, token).Forget(); _ = HandleLsp(inputSrc, token);
} }
private async UniTaskVoid HandleLsp(string inputSrc, CancellationToken cancellationToken) private async Task HandleLsp(string inputSrc, CancellationToken cancellationToken)
{ {
try try
{ {
await UniTask.SwitchToThreadPool(); if (cancellationToken.IsCancellationRequested)
return;
await Task.Delay(200, cancellationToken: cancellationToken);
if (cancellationToken.IsCancellationRequested) if (cancellationToken.IsCancellationRequested)
return; return;
await System.Threading.Tasks.Task.Delay(200, cancellationToken: cancellationToken); // Running this potentially CPU intensive work on a background thread.
var dict = await Task.Run(
if (cancellationToken.IsCancellationRequested) () =>
return; {
return Marshal
var dict = Marshal .DiagnoseSource(inputSrc)
.DiagnoseSource(inputSrc) .GroupBy(d => d.Range.StartLine)
.GroupBy(d => d.Range.StartLine) .ToDictionary(g => g.Key);
.ToDictionary(g => g.Key); },
cancellationToken
await UniTask.Yield(PlayerLoopTiming.Update, cancellationToken); );
ApplyDiagnostics(dict); ApplyDiagnostics(dict);
} }
@@ -136,7 +139,6 @@ public class SlangFormatter : ICodeFormatter
{ {
HashSet<uint> linesToRefresh; HashSet<uint> linesToRefresh;
// CRITICAL FIX FOR LINE SHIFTS:
// If the line count has changed (lines added/deleted), indices have shifted. // If the line count has changed (lines added/deleted), indices have shifted.
// We must refresh ALL lines to ensure any line that shifted into a new position // We must refresh ALL lines to ensure any line that shifted into a new position
// gets scrubbed of its old visual state. // gets scrubbed of its old visual state.

View File

@@ -5,7 +5,7 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AssemblyName>StationeersSlang</AssemblyName> <AssemblyName>StationeersSlang</AssemblyName>
<Description>Slang Compiler Bridge</Description> <Description>Slang Compiler Bridge</Description>
<Version>0.1.1</Version> <Version>0.1.2</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
@@ -39,10 +39,6 @@
<HintPath>./ref/Assembly-CSharp.dll</HintPath> <HintPath>./ref/Assembly-CSharp.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="UniTask">
<HintPath>./ref/UniTask.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="IC10Editor.dll"> <Reference Include="IC10Editor.dll">
<HintPath>./ref/IC10Editor.dll</HintPath> <HintPath>./ref/IC10Editor.dll</HintPath>

View File

@@ -843,7 +843,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
[[package]] [[package]]
name = "slang" name = "slang"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "slang" name = "slang"
version = "0.1.1" version = "0.1.2"
edition = "2021" edition = "2021"
[workspace] [workspace]