diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2024-10-02 15:01:27 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-10-02 15:01:27 +0200 |
| commit | 15cee4b8e08f9704c283607299b0992b8d58854e (patch) | |
| tree | 9df61d24149046c2b4089b64e08e820df0a0a3e2 | |
| parent | 991b741f6c4a3b7968662c318077c8af6932d7e2 (diff) | |
| parent | 0ad55e964fb288b47a6f26a6eb983c86d635cda7 (diff) | |
| download | redot-engine-15cee4b8e08f9704c283607299b0992b8d58854e.tar.gz | |
Merge pull request #97710 from anvilfolk/think-of-the-dooooooooooooooocs
Fix GDScript docs not updating when modified externally
| -rw-r--r-- | editor/editor_file_system.cpp | 7 | ||||
| -rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 18 |
2 files changed, 11 insertions, 14 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index afa0548044..2d1a914120 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -2089,12 +2089,11 @@ void EditorFileSystem::_update_script_documentation() { // return the last loaded version of the script (without the modifications). scr->reload_from_file(); } - Vector<DocData::ClassDoc> docs = scr->get_documentation(); - for (int j = 0; j < docs.size(); j++) { - EditorHelp::get_doc_data()->add_doc(docs[j]); + for (const DocData::ClassDoc &cd : scr->get_documentation()) { + EditorHelp::get_doc_data()->add_doc(cd); if (!first_scan) { // Update the documentation in the Script Editor if it is open. - ScriptEditor::get_singleton()->update_doc(docs[j].name); + ScriptEditor::get_singleton()->update_doc(cd.name); } } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 54730ec674..7e0331d15c 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2798,6 +2798,8 @@ void ScriptEditor::_reload_scripts(bool p_refresh_only) { scr->set_source_code(rel_scr->get_source_code()); scr->set_last_modified_time(rel_scr->get_last_modified_time()); scr->reload(true); + + update_docs_from_script(scr); } Ref<JSON> json = edited_res; @@ -3644,11 +3646,9 @@ void ScriptEditor::update_doc(const String &p_name) { void ScriptEditor::clear_docs_from_script(const Ref<Script> &p_script) { ERR_FAIL_COND(p_script.is_null()); - Vector<DocData::ClassDoc> documentations = p_script->get_documentation(); - for (int j = 0; j < documentations.size(); j++) { - const DocData::ClassDoc &doc = documentations.get(j); - if (EditorHelp::get_doc_data()->has_doc(doc.name)) { - EditorHelp::get_doc_data()->remove_doc(doc.name); + for (const DocData::ClassDoc &cd : p_script->get_documentation()) { + if (EditorHelp::get_doc_data()->has_doc(cd.name)) { + EditorHelp::get_doc_data()->remove_doc(cd.name); } } } @@ -3656,11 +3656,9 @@ void ScriptEditor::clear_docs_from_script(const Ref<Script> &p_script) { void ScriptEditor::update_docs_from_script(const Ref<Script> &p_script) { ERR_FAIL_COND(p_script.is_null()); - Vector<DocData::ClassDoc> documentations = p_script->get_documentation(); - for (int j = 0; j < documentations.size(); j++) { - const DocData::ClassDoc &doc = documentations.get(j); - EditorHelp::get_doc_data()->add_doc(doc); - update_doc(doc.name); + for (const DocData::ClassDoc &cd : p_script->get_documentation()) { + EditorHelp::get_doc_data()->add_doc(cd); + update_doc(cd.name); } } |
