Skip to content

Commit

Permalink
added: intellisense for code functions and bumped version
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhobox committed Jun 5, 2024
1 parent db16a04 commit 0b2011e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
19 changes: 19 additions & 0 deletions Kaenx.Creator/Controls/DynamicView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.ComponentModel;
using System.Reflection;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
Expand Down Expand Up @@ -248,6 +249,24 @@ private void ClickAddDynButton(object sender, RoutedEventArgs e)

private void ClickEditButtonFunction(object sender, RoutedEventArgs e)
{
string[] lines = Version.Script.Split("\n");
StringBuilder definitions = new StringBuilder();
definitions.AppendLine("window.x = [");
foreach(string line in lines)
{
if(line.Trim().StartsWith("function"))
{
string temp = line.Trim();
string declaration = "\"declare " + temp.Substring(0, temp.IndexOf(")")+1) + ";\",";
definitions.AppendLine(declaration);
}
}
definitions.AppendLine("].join('\\n');");


File.WriteAllText(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Data", "Monaco", "test.js"), definitions.ToString());


Models.Dynamic.DynButton item = (sender as Button).DataContext as Models.Dynamic.DynButton;
CodeWindow code = new CodeWindow("index_button_script.html", item.Script);
code.ShowDialog();
Expand Down
9 changes: 6 additions & 3 deletions Kaenx.Creator/Data/Monaco/index_button_script.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@
</script>
<script src="./editor/editor.main.nls.js"></script>
<script src="./editor/editor.main.js"></script>
<script src="./test.js"></script>
<script>

monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: true,
noSyntaxValidation: false
});

// compiler options
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ES6,
allowNonTsExtensions: true
allowNonTsExtensions: true,
allowJs: true
});

// extra libraries
Expand Down Expand Up @@ -73,7 +75,8 @@
'const device:DeviceObject;',
'const online:OnlineObject;',
'const progress:ProgressObject;',
'const ApplicationProgram:AppObject;'
'const ApplicationProgram:AppObject;',
window.x
].join('\n');
var libUri = 'ts:filename/facts.d.ts';
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
Expand Down
5 changes: 5 additions & 0 deletions Kaenx.Creator/Data/Monaco/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function getFloat(data, offset);
function getBytes(data);
function getParaInt(paraName);
function getParaFloat(paraName);
function getParaBool(paraName);
2 changes: 1 addition & 1 deletion Kaenx.Creator/Kaenx.Creator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net6.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationIcon>FileLogo.ico</ApplicationIcon>
<Version>1.8.1.0</Version>
<Version>1.8.2.0</Version>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
</PropertyGroup>

Expand Down

0 comments on commit 0b2011e

Please sign in to comment.