diff options
Diffstat (limited to 'modules/mono')
5 files changed, 44 insertions, 16 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 6ae9ce56c6..380b401683 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2826,7 +2826,7 @@ Ref<Resource> ResourceFormatLoaderCSharpScript::load(const String &p_path, const GDMonoCache::managed_callbacks.ScriptManagerBridge_GetOrCreateScriptBridgeForPath(&p_path, &scr); ERR_FAIL_COND_V_MSG(scr.is_null(), Ref<Resource>(), "Could not create C# script '" + real_path + "'."); } else { - scr = Ref<CSharpScript>(memnew(CSharpScript)); + scr.instantiate(); } #if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs index f54058b0d9..5af859c06b 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs @@ -32,9 +32,9 @@ partial class EventSignals add => backing_MySignal += value; remove => backing_MySignal -= value; } - protected void EmitSignalMySignal(string str, int num) + protected void EmitSignalMySignal(string @str, int @num) { - EmitSignal(SignalName.MySignal, str, num); + EmitSignal(SignalName.MySignal, @str, @num); } /// <inheritdoc/> [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs index 702c50d461..c7a7415851 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs @@ -295,7 +295,7 @@ namespace Godot.SourceGenerators for (int i = 0; i < paramCount; i++) { var paramSymbol = invokeMethodSymbol.Parameters[i]; - source.Append($"{paramSymbol.Type.FullQualifiedNameIncludeGlobal()} {paramSymbol.Name}"); + source.Append($"{paramSymbol.Type.FullQualifiedNameIncludeGlobal()} @{paramSymbol.Name}"); if (i < paramCount - 1) { source.Append(", "); @@ -310,11 +310,11 @@ namespace Godot.SourceGenerators if (paramSymbol.Type.TypeKind == TypeKind.Enum) { var underlyingType = ((INamedTypeSymbol)paramSymbol.Type).EnumUnderlyingType; - source.Append($", ({underlyingType.FullQualifiedNameIncludeGlobal()}){paramSymbol.Name}"); + source.Append($", ({underlyingType.FullQualifiedNameIncludeGlobal()})@{paramSymbol.Name}"); continue; } - source.Append($", {paramSymbol.Name}"); + source.Append($", @{paramSymbol.Name}"); } source.Append(");\n"); source.Append(" }\n"); diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index 788b46ab9a..74e04b46a1 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -177,7 +177,7 @@ namespace GodotTools private static readonly string[] VsCodeNames = { - "code", "code-oss", "vscode", "vscode-oss", "visual-studio-code", "visual-studio-code-oss" + "code", "code-oss", "vscode", "vscode-oss", "visual-studio-code", "visual-studio-code-oss", "codium" }; [UsedImplicitly] @@ -330,7 +330,7 @@ namespace GodotTools args.Add("-b"); args.Add(vscodeBundleId); - // The reusing of existing windows made by the 'open' command might not choose a wubdiw that is + // The reusing of existing windows made by the 'open' command might not choose a window that is // editing our folder. It's better to ask for a new window and let VSCode do the window management. args.Add("-n"); @@ -339,6 +339,28 @@ namespace GodotTools args.Add("--args"); } + + // Try VSCodium as a fallback if Visual Studio Code can't be found. + if (!macOSAppBundleInstalled) + { + const string VscodiumBundleId = "com.vscodium.codium"; + macOSAppBundleInstalled = Internal.IsMacOSAppBundleInstalled(VscodiumBundleId); + + if (macOSAppBundleInstalled) + { + args.Add("-b"); + args.Add(VscodiumBundleId); + + // The reusing of existing windows made by the 'open' command might not choose a window that is + // editing our folder. It's better to ask for a new window and let VSCode do the window management. + args.Add("-n"); + + // The open process must wait until the application finishes (which is instant in VSCode's case) + args.Add("--wait-apps"); + + args.Add("--args"); + } + } } args.Add(Path.GetDirectoryName(GodotSharpDirs.ProjectSlnPath)!); @@ -361,7 +383,7 @@ namespace GodotTools { if (!macOSAppBundleInstalled && string.IsNullOrEmpty(_vsCodePath)) { - GD.PushError("Cannot find code editor: VSCode"); + GD.PushError("Cannot find code editor: Visual Studio Code or VSCodium"); return Error.FileNotFound; } @@ -371,7 +393,7 @@ namespace GodotTools { if (string.IsNullOrEmpty(_vsCodePath)) { - GD.PushError("Cannot find code editor: VSCode"); + GD.PushError("Cannot find code editor: Visual Studio Code or VSCodium"); return Error.FileNotFound; } @@ -384,7 +406,7 @@ namespace GodotTools } catch (Exception e) { - GD.PushError($"Error when trying to run code editor: VSCode. Exception message: '{e.Message}'"); + GD.PushError($"Error when trying to run code editor: Visual Studio Code or VSCodium. Exception message: '{e.Message}'"); } break; @@ -550,7 +572,7 @@ namespace GodotTools { settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudio}" + $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + - $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + + $",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" + $",Custom:{(int)ExternalEditorId.CustomEditor}"; } @@ -558,14 +580,14 @@ namespace GodotTools { settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" + $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + - $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + + $",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" + $",Custom:{(int)ExternalEditorId.CustomEditor}"; } else if (OS.IsUnixLike) { settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + - $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + + $",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" + $",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" + $",Custom:{(int)ExternalEditorId.CustomEditor}"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs index dc151e2c3e..222ded6895 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs @@ -534,7 +534,10 @@ namespace Godot.NativeInterop [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Callable ConvertToCallable(in godot_variant p_var) - => Marshaling.ConvertCallableToManaged(ConvertToNativeCallable(p_var)); + { + using var callable = ConvertToNativeCallable(p_var); + return Marshaling.ConvertCallableToManaged(callable); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_signal ConvertToNativeSignal(in godot_variant p_var) @@ -542,7 +545,10 @@ namespace Godot.NativeInterop [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Signal ConvertToSignal(in godot_variant p_var) - => Marshaling.ConvertSignalToManaged(ConvertToNativeSignal(p_var)); + { + using var signal = ConvertToNativeSignal(p_var); + return Marshaling.ConvertSignalToManaged(signal); + } public static godot_array ConvertToNativeArray(in godot_variant p_var) => p_var.Type == Variant.Type.Array ? |