From 9535831866786adeafbff40f8e46f52fdc62538b Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Tue, 7 Dec 2021 21:00:26 +0100 Subject: [PATCH] Expose `ScriptEditor::edit` to scripting Exposes a method in `EditorInterface` to open scripts on a specified line and column. This method handles if the internal or the external editor should be used. --- doc/classes/EditorInterface.xml | 12 +++++++++++- editor/editor_plugin.cpp | 5 +++++ editor/editor_plugin.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index 5790d8c5aff..15d31cd0f08 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -21,7 +21,17 @@ - Edits the given [Resource]. + Edits the given [Resource]. If the resource is a [Script] you can also edit it with [method edit_script] to specify the line and column position. + + + + + + + + + + Edits the given [Script]. The line and column on which to open the script can also be specified. The script will be open with the user-configured editor for the script's language which may be an external editor. diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 61c01993aee..3261e6ddaf6 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -166,6 +166,10 @@ void EditorInterface::edit_node(Node *p_node) { EditorNode::get_singleton()->edit_node(p_node); } +void EditorInterface::edit_script(const Ref