Fix GDScript docs not updating when modified externally
This commit is contained in:
parent
f4af8201ba
commit
0ad55e964f
2 changed files with 11 additions and 14 deletions
|
@ -2089,12 +2089,11 @@ void EditorFileSystem::_update_script_documentation() {
|
||||||
// return the last loaded version of the script (without the modifications).
|
// return the last loaded version of the script (without the modifications).
|
||||||
scr->reload_from_file();
|
scr->reload_from_file();
|
||||||
}
|
}
|
||||||
Vector<DocData::ClassDoc> docs = scr->get_documentation();
|
for (const DocData::ClassDoc &cd : scr->get_documentation()) {
|
||||||
for (int j = 0; j < docs.size(); j++) {
|
EditorHelp::get_doc_data()->add_doc(cd);
|
||||||
EditorHelp::get_doc_data()->add_doc(docs[j]);
|
|
||||||
if (!first_scan) {
|
if (!first_scan) {
|
||||||
// Update the documentation in the Script Editor if it is open.
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2798,6 +2798,8 @@ void ScriptEditor::_reload_scripts(bool p_refresh_only) {
|
||||||
scr->set_source_code(rel_scr->get_source_code());
|
scr->set_source_code(rel_scr->get_source_code());
|
||||||
scr->set_last_modified_time(rel_scr->get_last_modified_time());
|
scr->set_last_modified_time(rel_scr->get_last_modified_time());
|
||||||
scr->reload(true);
|
scr->reload(true);
|
||||||
|
|
||||||
|
update_docs_from_script(scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<JSON> json = edited_res;
|
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) {
|
void ScriptEditor::clear_docs_from_script(const Ref<Script> &p_script) {
|
||||||
ERR_FAIL_COND(p_script.is_null());
|
ERR_FAIL_COND(p_script.is_null());
|
||||||
|
|
||||||
Vector<DocData::ClassDoc> documentations = p_script->get_documentation();
|
for (const DocData::ClassDoc &cd : p_script->get_documentation()) {
|
||||||
for (int j = 0; j < documentations.size(); j++) {
|
if (EditorHelp::get_doc_data()->has_doc(cd.name)) {
|
||||||
const DocData::ClassDoc &doc = documentations.get(j);
|
EditorHelp::get_doc_data()->remove_doc(cd.name);
|
||||||
if (EditorHelp::get_doc_data()->has_doc(doc.name)) {
|
|
||||||
EditorHelp::get_doc_data()->remove_doc(doc.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) {
|
void ScriptEditor::update_docs_from_script(const Ref<Script> &p_script) {
|
||||||
ERR_FAIL_COND(p_script.is_null());
|
ERR_FAIL_COND(p_script.is_null());
|
||||||
|
|
||||||
Vector<DocData::ClassDoc> documentations = p_script->get_documentation();
|
for (const DocData::ClassDoc &cd : p_script->get_documentation()) {
|
||||||
for (int j = 0; j < documentations.size(); j++) {
|
EditorHelp::get_doc_data()->add_doc(cd);
|
||||||
const DocData::ClassDoc &doc = documentations.get(j);
|
update_doc(cd.name);
|
||||||
EditorHelp::get_doc_data()->add_doc(doc);
|
|
||||||
update_doc(doc.name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue