Skip to content

Commit

Permalink
Merge pull request #82986 from OmarShehata/fix-external-editor-hot-re…
Browse files Browse the repository at this point in the history
…load

Fix external editor hot reload for GDScript
  • Loading branch information
akien-mga committed Oct 11, 2023
2 parents efc0b08 + c25a2d8 commit 25fa5ea
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion editor/plugins/script_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -538,6 +537,8 @@ class ScriptEditor : public PanelContainer {
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; }
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/script_text_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions modules/gdscript/language_server/gdscript_text_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 25fa5ea

Please sign in to comment.