Explorar el Código

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

(cherry picked from commit c01a47867be006439f31cce09e774c88d895c1f2)
crazyStewie hace 2 años
padre
commit
222cba2aab
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs

+ 4 - 0
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<string>();
                     var execArgs = _editorSettings.GetSetting(Settings.CustomExecPathArgs).As<string>();
                     var args = new List<string>();
@@ -226,6 +229,7 @@ namespace GodotTools
                                 hasFileFlag = true;
                             }
 
+                            arg = arg.ReplaceN("{project}", project);
                             arg = arg.ReplaceN("{file}", file);
                             args.Add(arg);