From beef0f687c053624f057f79a14878926b77e7e8f Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Sat, 8 Jun 2024 16:45:49 -0400 Subject: [PATCH] Expose `update_docs_from_script` method --- doc/classes/ScriptEditor.xml | 8 ++++++++ editor/plugins/script_editor_plugin.cpp | 1 + 2 files changed, 9 insertions(+) diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml index 43ee4dda605..c205b2b8f30 100644 --- a/doc/classes/ScriptEditor.xml +++ b/doc/classes/ScriptEditor.xml @@ -94,6 +94,14 @@ [b]Note:[/b] The [EditorSyntaxHighlighter] will still be applied to scripts that are already opened. + + + + + Updates the documentation for the given [param script] if the script's documentation is currently open. + [b]Note:[/b] This should be called whenever the script is changed to keep the open documentation state up to date. + + diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 334b253316a..7bf72d70a72 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3980,6 +3980,7 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("open_script_create_dialog", "base_name", "base_path"), &ScriptEditor::open_script_create_dialog); ClassDB::bind_method(D_METHOD("goto_help", "topic"), &ScriptEditor::goto_help); + ClassDB::bind_method(D_METHOD("update_docs_from_script", "script"), &ScriptEditor::update_docs_from_script); ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script"))); ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));