Skip to content

A Swiss Army knife for developers.

Fixed typescript compilation in UWP project

Etienne Baudouxf5caa4609419
diff --git a/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditor.Windows.html b/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditor.Windows.html
index c555ad0fa..9cced2165 100644
--- a/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditor.Windows.html
+++ b/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditor.Windows.html
@@ -17,14 +17,7 @@
</style>
<script src="https://devtoys.local/monaco-editor/min/vs/loader.js"></script>
- <script src="https://devtoys.local/ts-helpermethods/editorContext.js"></script>
- <script src="https://devtoys.local/ts-helpermethods/ts-helpermethods-Windows/asyncCallbackHelpers.js"></script>
- <script src="https://devtoys.local/ts-helpermethods/registerCodeLensProvider.js"></script>
- <script src="https://devtoys.local/ts-helpermethods/registerColorProvider.js"></script>
- <script src="https://devtoys.local/ts-helpermethods/registerCompletionItemProvider.js"></script>
- <script src="https://devtoys.local/ts-helpermethods/otherScriptsToBeOrganized.js"></script>
- <script src="https://devtoys.local/ts-helpermethods/updateSelection.js"></script>
- <script src="https://devtoys.local/ts-helpermethods/monacoInitializer.js"></script>
+ <script src="https://devtoys.local/WasmScripts/UWP/uno-monaco-helpers.g.js"></script>
</head>
<body>
diff --git a/src/app/dev/DevToys.MonacoEditor/DevToys.MonacoEditor.csproj b/src/app/dev/DevToys.MonacoEditor/DevToys.MonacoEditor.csproj
index 280248bc1..0628a533f 100644
--- a/src/app/dev/DevToys.MonacoEditor/DevToys.MonacoEditor.csproj
+++ b/src/app/dev/DevToys.MonacoEditor/DevToys.MonacoEditor.csproj
@@ -33,7 +33,8 @@
<ItemGroup>
<None Remove="ts-helpermethods\ts-helpermethods-Wasm\tsconfig.json" />
<None Remove="ts-helpermethods\ts-helpermethods-Windows\tsconfig.json" />
- <None Remove="WasmScripts\uno-monaco-helpers.js" />
+ <None Remove="WasmScripts\WASM\uno-monaco-helpers.g.js" />
+ <None Remove="WasmScripts\UWP\uno-monaco-helpers.g.js" />
<None Remove="monaco-editor\**\*.*" />
<TypeScriptCompile Remove="monaco-editor\**\*.*" />
<Content Include="monaco-editor\*.*" />
@@ -72,12 +73,16 @@
<None Remove="ts-helpermethods\**\*.js" />
<Content Remove="ts-helpermethods\**\*.js" />
<TypeScriptCompile Remove="ts-helpermethods\ts-helpermethods-Windows\**\*.js" />
- <Content Include="ts-helpermethods\ts-helpermethods-Wasm\tsconfig.json" />
- <None Include="ts-helpermethods\ts-helpermethods-Windows\tsconfig.json" />
- <EmbeddedResource Include="WasmScripts\uno-monaco-helpers.js" />
+ <Content Include="ts-helpermethods\ts-helpermethods-Wasm\tsconfig.json">
+ <CopyToOutputDirectory>Never</CopyToOutputDirectory>
+ </Content>
+ <ConfigFiles Include="ts-helpermethods\ts-helpermethods-Wasm\tsconfig.json" />
<Content Include="highlightjs\highlight.min.js" />
<Content Include="highlightjs\styles\**" />
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="WasmScripts\WASM\uno-monaco-helpers.g.js" />
+ </ItemGroup>
</When>
<When Condition="'$(TargetFramework)' == '$(NetCore)'">
@@ -101,14 +106,18 @@
<None Remove="ts-helpermethods\**\*.js" />
<Content Remove="ts-helpermethods\**\*.js" />
<TypeScriptCompile Remove="ts-helpermethods\ts-helpermethods-Windows\**\*.js" />
- <Content Include="ts-helpermethods\ts-helpermethods-Wasm\tsconfig.json" />
- <None Include="ts-helpermethods\ts-helpermethods-Windows\tsconfig.json" />
- <EmbeddedResource Include="WasmScripts\uno-monaco-helpers.js" />
+ <Content Include="ts-helpermethods\ts-helpermethods-Wasm\tsconfig.json">
+ <CopyToOutputDirectory>Never</CopyToOutputDirectory>
+ </Content>
+ <ConfigFiles Include="ts-helpermethods\ts-helpermethods-Wasm\tsconfig.json" />
<None Include="highlightjs\**" />
<EmbeddedResource Include="LinkerConfig.xml">
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="WasmScripts\WASM\uno-monaco-helpers.g.js" />
+ </ItemGroup>
</When>
<When Condition="'$(TargetFramework)' == '$(UAP)'">
@@ -135,15 +144,19 @@
<None Remove="ts-helpermethods\ts-helpermethods-Wasm\**\*.js" />
<Content Remove="ts-helpermethods\ts-helpermethods-Wasm\**\*.js" />
<TypeScriptCompile Remove="ts-helpermethods\ts-helpermethods-Wasm\**\*.*" />
- <Content Include="ts-helpermethods\ts-helpermethods-Windows\tsconfig.json" />
- <None Include="ts-helpermethods\ts-helpermethods-Wasm\tsconfig.json" />
+ <Content Include="ts-helpermethods\ts-helpermethods-Windows\tsconfig.json">
+ <CopyToOutputDirectory>Never</CopyToOutputDirectory>
+ </Content>
+ <ConfigFiles Include="ts-helpermethods\ts-helpermethods-Windows\tsconfig.json" />
<None Include="highlightjs\**" />
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="WasmScripts\UWP\uno-monaco-helpers.g.js" />
+ </ItemGroup>
</When>
</Choose>
<ItemGroup>
- <ProjectReference Include="..\DevToys.Api\DevToys.Api.csproj" />
<ProjectReference Include="..\DevToys.Core\DevToys.Core.csproj" />
<ProjectReference Include="..\DevToys.UI.Framework\DevToys.UI.Framework.csproj" />
</ItemGroup>
diff --git a/src/app/dev/DevToys.MonacoEditor/ts-helpermethods/ts-helpermethods-Wasm/tsconfig.json b/src/app/dev/DevToys.MonacoEditor/ts-helpermethods/ts-helpermethods-Wasm/tsconfig.json
index 534cf6864..592eb121e 100644
--- a/src/app/dev/DevToys.MonacoEditor/ts-helpermethods/ts-helpermethods-Wasm/tsconfig.json
+++ b/src/app/dev/DevToys.MonacoEditor/ts-helpermethods/ts-helpermethods-Wasm/tsconfig.json
@@ -1,11 +1,10 @@
{
"compileOnSave": true,
"compilerOptions": {
- "emitBOM": false,
"target": "es2015", // Warning: Monaco editor breaks when using something else than es2015
"lib": [ "es2015", "DOM" ], // Warning: Monaco editor breaks when using something else than es2015
"sourceMap": true,
- "outFile": "..\\..\\WasmScripts\\uno-monaco-helpers.js"
+ "outFile": "..\\..\\WasmScripts\\WASM\\uno-monaco-helpers.g.js"
},
"include": [
".\\",
diff --git a/src/app/dev/DevToys.MonacoEditor/ts-helpermethods/ts-helpermethods-Windows/tsconfig.json b/src/app/dev/DevToys.MonacoEditor/ts-helpermethods/ts-helpermethods-Windows/tsconfig.json
index 5899d987c..20ae6401f 100644
--- a/src/app/dev/DevToys.MonacoEditor/ts-helpermethods/ts-helpermethods-Windows/tsconfig.json
+++ b/src/app/dev/DevToys.MonacoEditor/ts-helpermethods/ts-helpermethods-Windows/tsconfig.json
@@ -1,8 +1,10 @@
{
"compileOnSave": true,
"compilerOptions": {
- "target": "es2015",
- "sourceMap": false
+ "target": "es2015", // Warning: Monaco editor breaks when using something else than es2015
+ "lib": [ "es2015", "DOM" ], // Warning: Monaco editor breaks when using something else than es2015
+ "sourceMap": true,
+ "outFile": "..\\..\\WasmScripts\\UWP\\uno-monaco-helpers.g.js"
},
"include": [
".\\",
diff --git a/src/app/dev/DevToys.Api/Core/Threading/TaskSchedulerAwaiter.cs b/src/app/dev/DevToys.UI.Framework/Threading/TaskSchedulerAwaiter.cs
similarity index 96%
rename from src/app/dev/DevToys.Api/Core/Threading/TaskSchedulerAwaiter.cs
rename to src/app/dev/DevToys.UI.Framework/Threading/TaskSchedulerAwaiter.cs
index 4c23a4a50..8fc8ae471 100644
--- a/src/app/dev/DevToys.Api/Core/Threading/TaskSchedulerAwaiter.cs
+++ b/src/app/dev/DevToys.UI.Framework/Threading/TaskSchedulerAwaiter.cs
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;
-namespace DevToys.Api;
+namespace DevToys.UI.Framework.Threading;
/// <summary>
/// An awaiter returned from <see cref="GetAwaiter(TaskScheduler)"/>.
@@ -88,7 +88,7 @@ public readonly struct TaskSchedulerAwaiter : ICriticalNotifyCompletion
}
else
{
- Task.Factory.StartNew(continuation, CancellationToken.None, TaskCreationOptions.None, _scheduler).Forget();
+ Task.Factory.StartNew(continuation, CancellationToken.None, TaskCreationOptions.None, _scheduler);
}
}
@@ -105,7 +105,7 @@ public readonly struct TaskSchedulerAwaiter : ICriticalNotifyCompletion
}
else
{
- Task.Factory.StartNew(continuation, CancellationToken.None, TaskCreationOptions.None, _scheduler).Forget();
+ Task.Factory.StartNew(continuation, CancellationToken.None, TaskCreationOptions.None, _scheduler);
}
}