summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-10-11 22:38:42 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-10-11 22:38:42 +0200
commit25fa5eadd5dd68051613ad0ea9b4d26f7fb8177b (patch)
treee6e2db9c7fb7cd29f0828678630035412a5d2102
parentefc0b0837100b199860d477459459e5a9108a892 (diff)
parentc25a2d832b3d706f6a1ba6cd5135c8213afe172d (diff)
downloadredot-engine-25fa5eadd5dd68051613ad0ea9b4d26f7fb8177b.tar.gz
Merge pull request #82986 from OmarShehata/fix-external-editor-hot-reload
Fix external editor hot reload for GDScript
-rw-r--r--editor/plugins/script_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.h3
-rw-r--r--editor/plugins/script_text_editor.cpp2
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp2
4 files changed, 7 insertions, 4 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index facc8afa6a..79e260ef35 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -997,7 +997,7 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
}
_update_script_names();
- _trigger_live_script_reload();
+ trigger_live_script_reload();
}
void ScriptEditor::_scene_saved_callback(const String &p_path) {
@@ -1025,7 +1025,7 @@ void ScriptEditor::_scene_saved_callback(const String &p_path) {
}
}
-void ScriptEditor::_trigger_live_script_reload() {
+void ScriptEditor::trigger_live_script_reload() {
if (!pending_auto_reload && auto_reload_running_scripts) {
call_deferred(SNAME("_live_auto_reload_running_scripts"));
pending_auto_reload = true;
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 0241ca0e3e..cf071d182b 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -378,7 +378,6 @@ class ScriptEditor : public PanelContainer {
bool pending_auto_reload;
bool auto_reload_running_scripts;
- void _trigger_live_script_reload();
void _live_auto_reload_running_scripts();
void _update_selected_editor_menu();
@@ -538,6 +537,8 @@ public:
void clear_docs_from_script(const Ref<Script> &p_script);
void update_docs_from_script(const Ref<Script> &p_script);
+ void trigger_live_script_reload();
+
bool can_take_away_focus() const;
VSplitContainer *get_left_list_split() { return list_split; }
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index e0f8af95c1..5b67c6d509 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -822,7 +822,7 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
scr->set_last_modified_time(rel_scr->get_last_modified_time());
scr->update_exports();
- _trigger_live_script_reload();
+ trigger_live_script_reload();
}
}
}
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index d6779dc71c..44f605232d 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -110,9 +110,11 @@ void GDScriptTextDocument::didSave(const Variant &p_param) {
} else {
scr->reload(true);
}
+
scr->update_exports();
ScriptEditor::get_singleton()->reload_scripts(true);
ScriptEditor::get_singleton()->update_docs_from_script(scr);
+ ScriptEditor::get_singleton()->trigger_live_script_reload();
}
}