From c01a47867be006439f31cce09e774c88d895c1f2 Mon Sep 17 00:00:00 2001 From: crazyStewie Date: Mon, 18 Sep 2023 01:10:42 -0300 Subject: [PATCH] Implemented {project} placeholder for external dotnet editor Implements the {project} placeholder, available when setting an external editor in the project settings, via Editor > Editor Settings > Text Editor > External for the c# external editor, under Editor > Editor Settings > Dotnet > Editor, This allows passing the project folder as a command line argument when using a custom external editor that isn't one of the available options. Fixes #81845 --- modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index 1c1185d91b6..e186c0302bb 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -190,6 +190,9 @@ namespace GodotTools case ExternalEditorId.CustomEditor: { string file = ProjectSettings.GlobalizePath(script.ResourcePath); + string project = ProjectSettings.GlobalizePath("res://"); + // Since ProjectSettings.GlobalizePath replaces only "res:/", leaving a trailing slash, it is removed here. + project = project[..^1]; var execCommand = _editorSettings.GetSetting(Settings.CustomExecPath).As(); var execArgs = _editorSettings.GetSetting(Settings.CustomExecPathArgs).As(); var args = new List(); @@ -226,6 +229,7 @@ namespace GodotTools hasFileFlag = true; } + arg = arg.ReplaceN("{project}", project); arg = arg.ReplaceN("{file}", file); args.Add(arg);