From 229489f7b76c6f3cd12f04db2ff39647d220ed27 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. (cherry picked from commit 9535831866786adeafbff40f8e46f52fdc62538b) --- 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 8d038be56d5..ea2798205ac 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 ff4b4728abf..2878ac5e561 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -165,6 +165,10 @@ void EditorInterface::edit_node(Node *p_node) { EditorNode::get_singleton()->edit_node(p_node); } +void EditorInterface::edit_script(const Ref