diff --git a/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs b/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs index 2627eff..7b97195 100644 --- a/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs +++ b/src/SharpIDE.Application/Features/Analysis/RoslynAnalysis.cs @@ -121,7 +121,8 @@ public static class RoslynAnalysis Guard.Against.Null(compilation, nameof(compilation)); var diagnostics = compilation.GetDiagnostics(cancellationToken); - return diagnostics.Where(d => d.Severity is not DiagnosticSeverity.Hidden).ToImmutableArray(); + diagnostics = diagnostics.Where(d => d.Severity is not DiagnosticSeverity.Hidden).ToImmutableArray(); + return diagnostics; } public static async Task> GetCodeFixesAsync(Diagnostic diagnostic) diff --git a/src/SharpIDE.Godot/CascadiaCode.ttf b/src/SharpIDE.Godot/CascadiaCode.ttf new file mode 100644 index 0000000..bba59c9 Binary files /dev/null and b/src/SharpIDE.Godot/CascadiaCode.ttf differ diff --git a/src/SharpIDE.Godot/CascadiaCode.ttf.import b/src/SharpIDE.Godot/CascadiaCode.ttf.import new file mode 100644 index 0000000..e650bdd --- /dev/null +++ b/src/SharpIDE.Godot/CascadiaCode.ttf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://7jc0nj310cu6" +path="res://.godot/imported/CascadiaCode.ttf-a3719bc78bb5325e1cfcc893e4ab58da.fontdata" + +[deps] + +source_file="res://CascadiaCode.ttf" +dest_files=["res://.godot/imported/CascadiaCode.ttf-a3719bc78bb5325e1cfcc893e4ab58da.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/src/SharpIDE.Godot/CustomSyntaxHighlighter.cs b/src/SharpIDE.Godot/CustomSyntaxHighlighter.cs new file mode 100644 index 0000000..44dec52 --- /dev/null +++ b/src/SharpIDE.Godot/CustomSyntaxHighlighter.cs @@ -0,0 +1,30 @@ +using System.Linq; +using Godot; +using Godot.Collections; +using System.Text.RegularExpressions; + +namespace SharpIDE.Godot; + +public partial class CustomHighlighter : SyntaxHighlighter +{ + public override Dictionary _GetLineSyntaxHighlighting(int line) + { + var highlights = new Dictionary(); + var text = GetTextEdit().GetLine(line); + + var regex = new Regex(@"\bTODO\b"); + var matches = regex.Matches(text); + + foreach (Match match in matches) + { + highlights[match.Index] = new Dictionary + { + { "color", new Color(1, 0, 0) }, // red + { "underline", true }, // not implemented + { "length", match.Length } // not implemented + }; + } + + return highlights; + } +} diff --git a/src/SharpIDE.Godot/CustomSyntaxHighlighter.cs.uid b/src/SharpIDE.Godot/CustomSyntaxHighlighter.cs.uid new file mode 100644 index 0000000..a6911bb --- /dev/null +++ b/src/SharpIDE.Godot/CustomSyntaxHighlighter.cs.uid @@ -0,0 +1 @@ +uid://b6wpiabl7sutg diff --git a/src/SharpIDE.Godot/ExampleScript.gd b/src/SharpIDE.Godot/ExampleScript.gd index 08fdaf3..84a8df2 100644 --- a/src/SharpIDE.Godot/ExampleScript.gd +++ b/src/SharpIDE.Godot/ExampleScript.gd @@ -1,6 +1,51 @@ -extends Node +extends Node2D +# Declare an empty dictionary object +var game = {} - - -# asdfasdfasdfadsf asdf asdfa sdfadf +func _ready(): + # Initialize a player dictionary + var player = { + "name": "Thor", + "inventory": ["sword", "shield", "map"], + "location": "Castellion", + "energy": 67 + } + + if game.empty(): + # Add data to the game dictionary + game["player"] = player + game["score"] = 0 + game["dummy"] = null + + if game.has("dummy"): + game.erase("dummy") + + print(game.get("dummy", "Key not found!")) + + if game.has_all(["player", "score"]): + print(game["player"]["name"]) + + player["energy"] += 1 + + print(game.keys().size()) + print(game.size()) + print(player.values()[0]) + + # Alternative way to initialize a dictionary + var d = { + a = { + a1 = { + a11 = 1, a12 = 2 + }, + a2 = 3 + }, + b = 1 + } + + # Make copies of the dictionary + var deep_copy = d.duplicate(true) + var shallow_copy = d.duplicate() + print(deep_copy) + # I expected the shallow copy to be truncated + print(shallow_copy) diff --git a/src/SharpIDE.Godot/IdeRoot.cs b/src/SharpIDE.Godot/IdeRoot.cs index 119f527..32974a4 100644 --- a/src/SharpIDE.Godot/IdeRoot.cs +++ b/src/SharpIDE.Godot/IdeRoot.cs @@ -1,4 +1,14 @@ +using System; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.Loader; using Godot; +using Microsoft.Build.Locator; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.Host.Mef; +using SharpIDE.Application.Features.Analysis; +using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence; namespace SharpIDE.Godot; @@ -8,13 +18,26 @@ public partial class IdeRoot : Control private FileDialog _fileDialog = null!; public override void _Ready() { + MSBuildLocator.RegisterDefaults(); + _openSlnButton = GetNode