summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2023-02-09 14:01:33 +0100
committerGitHub <noreply@github.com>2023-02-09 14:01:33 +0100
commitb12bf7ff0219bfec86d481b35355a43ee0ee59fa (patch)
tree559442ee0b4a412276622e15b0e50770a4a6e259 /editor
parentd02a7bc00d76d50843f1b938914340135060a119 (diff)
parent64edc7a5c2397e5330a587d40b4d0275bf9a9c9e (diff)
Merge pull request #69550 from Rindbee/fix-script-editor-not-reload-via-lsp
Fix internal editor not updating when using external editor via LSP
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/script_editor_plugin.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index e515b46b1e..74d82aa4a2 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -2528,7 +2528,7 @@ void ScriptEditor::reload_scripts(bool p_refresh_only) {
}
Ref<Script> scr = edited_res;
- if (scr != nullptr) {
+ if (scr.is_valid()) {
Ref<Script> rel_scr = ResourceLoader::load(scr->get_path(), scr->get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
ERR_CONTINUE(!rel_scr.is_valid());
scr->set_source_code(rel_scr->get_source_code());
@@ -2537,12 +2537,8 @@ void ScriptEditor::reload_scripts(bool p_refresh_only) {
}
Ref<TextFile> text_file = edited_res;
- if (text_file != nullptr) {
- Error err;
- Ref<TextFile> rel_text_file = _load_text_file(text_file->get_path(), &err);
- ERR_CONTINUE(!rel_text_file.is_valid());
- text_file->set_text(rel_text_file->get_text());
- text_file->set_last_modified_time(rel_text_file->get_last_modified_time());
+ if (text_file.is_valid()) {
+ text_file->reload_from_file();
}
}