Skip to content

Commit 15cee4b

Browse files
committed
Merge pull request godotengine#97710 from anvilfolk/think-of-the-dooooooooooooooocs
Fix GDScript docs not updating when modified externally
2 parents 991b741 + 0ad55e9 commit 15cee4b

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

editor/editor_file_system.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,12 +2089,11 @@ void EditorFileSystem::_update_script_documentation() {
20892089
// return the last loaded version of the script (without the modifications).
20902090
scr->reload_from_file();
20912091
}
2092-
Vector<DocData::ClassDoc> docs = scr->get_documentation();
2093-
for (int j = 0; j < docs.size(); j++) {
2094-
EditorHelp::get_doc_data()->add_doc(docs[j]);
2092+
for (const DocData::ClassDoc &cd : scr->get_documentation()) {
2093+
EditorHelp::get_doc_data()->add_doc(cd);
20952094
if (!first_scan) {
20962095
// Update the documentation in the Script Editor if it is open.
2097-
ScriptEditor::get_singleton()->update_doc(docs[j].name);
2096+
ScriptEditor::get_singleton()->update_doc(cd.name);
20982097
}
20992098
}
21002099
}

editor/plugins/script_editor_plugin.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,6 +2798,8 @@ void ScriptEditor::_reload_scripts(bool p_refresh_only) {
27982798
scr->set_source_code(rel_scr->get_source_code());
27992799
scr->set_last_modified_time(rel_scr->get_last_modified_time());
28002800
scr->reload(true);
2801+
2802+
update_docs_from_script(scr);
28012803
}
28022804

28032805
Ref<JSON> json = edited_res;
@@ -3644,23 +3646,19 @@ void ScriptEditor::update_doc(const String &p_name) {
36443646
void ScriptEditor::clear_docs_from_script(const Ref<Script> &p_script) {
36453647
ERR_FAIL_COND(p_script.is_null());
36463648

3647-
Vector<DocData::ClassDoc> documentations = p_script->get_documentation();
3648-
for (int j = 0; j < documentations.size(); j++) {
3649-
const DocData::ClassDoc &doc = documentations.get(j);
3650-
if (EditorHelp::get_doc_data()->has_doc(doc.name)) {
3651-
EditorHelp::get_doc_data()->remove_doc(doc.name);
3649+
for (const DocData::ClassDoc &cd : p_script->get_documentation()) {
3650+
if (EditorHelp::get_doc_data()->has_doc(cd.name)) {
3651+
EditorHelp::get_doc_data()->remove_doc(cd.name);
36523652
}
36533653
}
36543654
}
36553655

36563656
void ScriptEditor::update_docs_from_script(const Ref<Script> &p_script) {
36573657
ERR_FAIL_COND(p_script.is_null());
36583658

3659-
Vector<DocData::ClassDoc> documentations = p_script->get_documentation();
3660-
for (int j = 0; j < documentations.size(); j++) {
3661-
const DocData::ClassDoc &doc = documentations.get(j);
3662-
EditorHelp::get_doc_data()->add_doc(doc);
3663-
update_doc(doc.name);
3659+
for (const DocData::ClassDoc &cd : p_script->get_documentation()) {
3660+
EditorHelp::get_doc_data()->add_doc(cd);
3661+
update_doc(cd.name);
36643662
}
36653663
}
36663664

0 commit comments

Comments
 (0)