Skip to content

Commit c01a478

Browse files
committed
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
1 parent 4df80b0 commit c01a478

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ public Error OpenInExternalEditor(Script script, int line, int col)
190190
case ExternalEditorId.CustomEditor:
191191
{
192192
string file = ProjectSettings.GlobalizePath(script.ResourcePath);
193+
string project = ProjectSettings.GlobalizePath("res://");
194+
// Since ProjectSettings.GlobalizePath replaces only "res:/", leaving a trailing slash, it is removed here.
195+
project = project[..^1];
193196
var execCommand = _editorSettings.GetSetting(Settings.CustomExecPath).As<string>();
194197
var execArgs = _editorSettings.GetSetting(Settings.CustomExecPathArgs).As<string>();
195198
var args = new List<string>();
@@ -226,6 +229,7 @@ public Error OpenInExternalEditor(Script script, int line, int col)
226229
hasFileFlag = true;
227230
}
228231

232+
arg = arg.ReplaceN("{project}", project);
229233
arg = arg.ReplaceN("{file}", file);
230234
args.Add(arg);
231235

0 commit comments

Comments
 (0)