Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 233b38e
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Sun Dec 3 01:21:20 2023 -0600

    disabled incremental lexer

commit 8699739
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Sat Dec 2 23:31:01 2023 -0600

    ostw wasm: 'remove file' handler

commit bcc187b
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Sat Dec 2 19:57:59 2023 -0600

    ostw wasm: open project & lobby settings

commit d291dc0
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Mon Nov 27 19:34:34 2023 -0600

    ostw wasm: File manager

commit 34e25a7
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Wed Nov 22 23:48:43 2023 -0600

    Prevent multiple langserver initiations when awaiting elements.json

commit a9aa806
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Wed Nov 22 18:26:04 2023 -0600

    Web hover provider

commit d1ccb32
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Thu Nov 16 23:53:19 2023 -0600

    ostw wasm: Signature help

commit b708b9d
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Thu Nov 16 19:07:00 2023 -0600

    ostw wasm: Interp CompletionItem

commit 46f4f48
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Thu Nov 16 17:11:35 2023 -0600

    Reworked script update delay behaviour

commit 9ef906e
Author: ItsDeltin <grittydeltin@gmail.com>
Date:   Thu Nov 16 14:32:08 2023 -0600

    wip: ostw wasm
  • Loading branch information
ItsDeltin committed Dec 3, 2023
1 parent 32d784e commit 8fb2fd4
Show file tree
Hide file tree
Showing 43 changed files with 1,735 additions and 1,288 deletions.
143 changes: 8 additions & 135 deletions Deltinteger/Deltinteger/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
Expand All @@ -14,140 +14,13 @@
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "integratedTerminal",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
{
"name": "Attach to Deltinteger",
"type": "coreclr",
"request": "attach",
"processName": "Deltinteger"
},
{
"name": "Debug Script",
"type":"coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["${file}"],
"console": "externalTerminal",
"stopAtEntry": true,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Language Server Debug",
"type":"coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--langserver"],
"console": "externalTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Generate Economic Alphabet",
"type":"coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--generatealphabet"],
"console": "externalTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Build Pathfind Editor",
"type":"coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--editor"],
"console": "externalTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "i18n link",
"type":"coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--i18nlink"],
"console": "externalTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "i18n generator",
"type":"coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--i18n", "C:/Users/Deltin/Downloads/toolchain-release/DataTool.exe", "C:/Users/Deltin/Documents/GitHub/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Languages/key_links.xml", "C:/Users/Deltin/Documents/GitHub/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Languages/"],
"console": "externalTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Wiki",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--wiki"],
"console": "externalTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Setting schema",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--schema"],
"console": "integratedTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Lobby maps",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--maps", "C:/Users/Deltin/Downloads/toolchain-release/DataTool.exe", "C:/Program Files (x86)/Overwatch", "C:/Users/Deltin/Documents/OverwatchMapInfo.json"],
"console": "integratedTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Function name table",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/Deltinteger.dll",
"args":["--function-table"],
"console": "integratedTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Debug ANTLR4 grammar",
"type": "antlr-debug",
"request": "launch",
"input": "C:/Users/Deltin/Documents/GitHub/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Modules/PathfindEditor.del",
"grammar": "DeltinScript.g4",
"startRule": "ruleset",
"printParseTree": true,
"visualParseTree": true
"request": "attach"
}
]
}
}
5 changes: 2 additions & 3 deletions Deltinteger/Deltinteger/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
"args": [
"watch",
"run",
"${workspaceFolder}/Deltinteger.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
"--project",
"${workspaceFolder}/Deltinteger.csproj"
],
"problemMatcher": "$msCompile"
}
Expand Down
9 changes: 6 additions & 3 deletions Deltinteger/Deltinteger/Compiler/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ public void Update(string newContent, UpdateRange updateRange, int? version, Par
}
else
{
Lexer.Update(new VersionInstance(newContent), updateRange);
Parse();
ParseFromScratch();
// incremental lexer is having some issues
// todo: make toggleable in ParserSettings!
// Lexer.Update(new VersionInstance(newContent), updateRange);
// Parse();
}
}

Expand Down Expand Up @@ -87,7 +90,7 @@ private void ParseFromScratch()
Text = Content,
LanguageId = "ostw"
};

public void Remove()
{
Cache.Unregister();
Expand Down
10 changes: 0 additions & 10 deletions Deltinteger/Deltinteger/Debug.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Deltin.Deltinteger
{
public class Log
{
public static LogLevel LogLevel = LogLevel.Normal;

public static object Passer(object obj)
{
Console.WriteLine(obj);
return obj;
}

public Log(string name)
{
this.name = name;
Expand Down
10 changes: 6 additions & 4 deletions Deltinteger/Deltinteger/Debugger/Debugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ namespace Deltin.Deltinteger.Debugger
class ClipboardListener
{
public DebugVariableLinkCollection VariableCollection;
private readonly DeltintegerLanguageServer _languageServer;
private readonly OstwLangServer _languageServer;
private readonly object _currentLock = new object();
private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();

public ClipboardListener(DeltintegerLanguageServer languageServer)
public ClipboardListener(OstwLangServer languageServer)
{
_languageServer = languageServer;
}
Expand Down Expand Up @@ -59,7 +59,8 @@ async Task Listen()

// Action list successfully parsed.
// Get the DeltinScript.
VariableCollection = (await _languageServer.DocumentHandler.OnScriptAvailability())?.DebugVariables;
// todo
// VariableCollection = (await _languageServer.DocumentHandler.OnScriptAvailability())?.DebugVariables;

// Error obtaining debug variables.
if (VariableCollection == null) return;
Expand All @@ -68,7 +69,8 @@ async Task Listen()
VariableCollection.Apply(actionStream);

// Notify the adapter of the new state.
_languageServer.Server.SendNotification("debugger.activated");
// todo
// _languageServer.ProtocolServer.SendNotification("debugger.activated");
}
}
catch (Exception ex)
Expand Down
25 changes: 25 additions & 0 deletions Deltinteger/Deltinteger/Decompiler/Decompiler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace Deltin.Deltinteger.Decompiler;

using System;
using Deltin.Deltinteger.Decompiler.ElementToCode;
using TextToElement;

static class Decompiler
{
public static DecompileResult DecompileWorkshop(string code)
{
try
{
var tte = new ConvertTextToElement(code);
var workshop = tte.Get();
var workshopToCode = new WorkshopDecompiler(workshop, new OmitLobbySettingsResolver(), new CodeFormattingOptions());
var ostw = workshopToCode.Decompile();

return new DecompileResult(tte, ostw);
}
catch (Exception ex)
{
return new DecompileResult(ex);
}
}
}
6 changes: 3 additions & 3 deletions Deltinteger/Deltinteger/Decompiler/TextToElement/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class DecompileResult

[JsonProperty("original")]
public string Original { get; }

public bool Success => Result == "success";

public DecompileResult(ConvertTextToElement tte, string code)
Expand All @@ -45,11 +45,11 @@ public DecompileResult(Exception exception)
Exception = exception.ToString();
}

public DocRange GetErrorRange(ConvertTextToElement tte)
public static DocRange GetErrorRange(ConvertTextToElement tte)
{
string localStream = tte.LocalStream;
int endLine = tte.Line, endCharacter = tte.Character;

for (int i = 0; i < localStream.Length; i++)
// Get the range up until the next whitespace.
if (char.IsWhiteSpace(localStream[i]) || char.IsSymbol(localStream[i]))
Expand Down
14 changes: 4 additions & 10 deletions Deltinteger/Deltinteger/Deltinteger.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Deltin</RootNamespace>
<LangVersion>10.0</LangVersion>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;browser-wasm</RuntimeIdentifiers>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WasmMainJSPath>main.js</WasmMainJSPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.16"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
<PackageReference Include="TextCopy" Version="1.7.1"/>
<PackageReference Include="System.Drawing.Common" Version="4.7.2"/>
<PackageReference Include="OmniSharp.Extensions.LanguageServer" Version="0.19.7"/>
<PackageReference Include="Serilog" Version="2.9.0"/>
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0"/>
Expand All @@ -24,12 +24,6 @@
<Content Include="Modules\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Fonts\BigNoodleTooOblique.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Wiki.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Maps.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
7 changes: 6 additions & 1 deletion Deltinteger/Deltinteger/Elements/Structure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ namespace Deltin.Deltinteger.Elements
{
public class ElementRoot
{
public static ElementRoot Instance { get; } = Get(File.ReadAllText(Path.Combine(Program.ExeFolder, "Elements.json")));
public static ElementRoot Instance { get; private set; }

public static void LoadFromJson(string json)
{
Instance = Get(json);
}

[JsonProperty("values")]
public ElementJsonValue[] Values;
Expand Down
Loading

0 comments on commit 8fb2fd4

Please sign in to comment.