Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
f38c15da9c
|
|||
| fdd1a311d5 | |||
|
fb7ca0d4fd
|
5
Changelog.md
Normal file
5
Changelog.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
[0.1.2]
|
||||
|
||||
- Removed references to `Unitask`
|
||||
@@ -1,14 +1,14 @@
|
||||
<?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">
|
||||
<Name>StationeersSlang</Name>
|
||||
<Name>Slang</Name>
|
||||
<Author>JoeDiertay</Author>
|
||||
<Version>0.1.1</Version>
|
||||
<Version>0.1.2</Version>
|
||||
<Description>
|
||||
[h1]Slang: High-Level Programming for Stationeers[/h1]
|
||||
|
||||
Stop writing assembly. Start writing code.
|
||||
|
||||
Slang (Stationeers Language) brings modern programming to Stationeers. It allows you to write scripts using a familiar C-style syntax (variables, functions, if/else, loops) directly in the in-game editor. When you hit confirm, Slang compiles your code into optimized IC10 MIPS assembly instantly.
|
||||
Slang (Stationeers Language) brings modern programming to Stationeers. It allows you to write scripts using a familiar C-style syntax (variables, functions, if/else, loops) directly in the in-game editor. When you hit confirm, Slang compiles your code into IC10 instantly.
|
||||
|
||||
[b]NOTE: This project is in BETA. Expect updates and changes![/b]
|
||||
|
||||
@@ -91,7 +91,7 @@ A: Yes! Slang does not modify any existing IC10 code, it is only a compiler. As
|
||||
<OrderBefore WorkshopHandle="3592775931" />
|
||||
<InGameDescription><![CDATA[
|
||||
<size=30><color=#ffff00>Slang - High Level Language Compiler</color></size>
|
||||
A modern programming experience for Stationeers. Write C-style code that compiles to MIPS assembly instantly.
|
||||
A modern programming experience for Stationeers. Write C-style code that compiles to IC10 instantly.
|
||||
|
||||
<color=#ffa500><b>Features</b></color>
|
||||
- <b>In-Game Compilation:</b> Write high-level logic directly in the chip editor.
|
||||
|
||||
@@ -4,7 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using StationeersIC10Editor;
|
||||
|
||||
public class SlangFormatter : ICodeFormatter
|
||||
@@ -98,29 +98,32 @@ public class SlangFormatter : ICodeFormatter
|
||||
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
|
||||
{
|
||||
await UniTask.SwitchToThreadPool();
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
await Task.Delay(200, cancellationToken: cancellationToken);
|
||||
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
await System.Threading.Tasks.Task.Delay(200, cancellationToken: cancellationToken);
|
||||
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
var dict = Marshal
|
||||
// Running this potentially CPU intensive work on a background thread.
|
||||
var dict = await Task.Run(
|
||||
() =>
|
||||
{
|
||||
return Marshal
|
||||
.DiagnoseSource(inputSrc)
|
||||
.GroupBy(d => d.Range.StartLine)
|
||||
.ToDictionary(g => g.Key);
|
||||
|
||||
await UniTask.Yield(PlayerLoopTiming.Update, cancellationToken);
|
||||
},
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
ApplyDiagnostics(dict);
|
||||
}
|
||||
@@ -136,7 +139,6 @@ public class SlangFormatter : ICodeFormatter
|
||||
{
|
||||
HashSet<uint> linesToRefresh;
|
||||
|
||||
// CRITICAL FIX FOR LINE SHIFTS:
|
||||
// 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
|
||||
// gets scrubbed of its old visual state.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>StationeersSlang</AssemblyName>
|
||||
<Description>Slang Compiler Bridge</Description>
|
||||
<Version>0.1.1</Version>
|
||||
<Version>0.1.2</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
@@ -39,10 +39,6 @@
|
||||
<HintPath>./ref/Assembly-CSharp.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UniTask">
|
||||
<HintPath>./ref/UniTask.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
|
||||
<Reference Include="IC10Editor.dll">
|
||||
<HintPath>./ref/IC10Editor.dll</HintPath>
|
||||
|
||||
2
rust_compiler/Cargo.lock
generated
2
rust_compiler/Cargo.lock
generated
@@ -843,7 +843,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
|
||||
|
||||
[[package]]
|
||||
name = "slang"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "slang"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
Reference in New Issue
Block a user