summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--editor/connections_dialog.cpp2
-rw-r--r--editor/editor_file_system.cpp36
-rw-r--r--modules/gdscript/gdscript.cpp5
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp2
4 files changed, 29 insertions, 16 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index ce2c1a5a16..1c269a62c5 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -41,9 +41,9 @@
#include "editor/editor_undo_redo_manager.h"
#include "editor/gui/scene_tree_editor.h"
#include "editor/node_dock.h"
+#include "editor/plugins/script_editor_plugin.h"
#include "editor/scene_tree_dock.h"
#include "editor/themes/editor_scale.h"
-#include "plugins/script_editor_plugin.h"
#include "scene/gui/button.h"
#include "scene/gui/check_box.h"
#include "scene/gui/label.h"
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index b1b64b5d60..85ceaa662e 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -42,6 +42,7 @@
#include "editor/editor_paths.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_settings.h"
+#include "editor/plugins/script_editor_plugin.h"
#include "editor/project_settings_editor.h"
#include "scene/resources/packed_scene.h"
@@ -806,18 +807,11 @@ bool EditorFileSystem::_update_scan_actions() {
case ItemAction::ACTION_FILE_RELOAD: {
int idx = ia.dir->find_file_index(ia.file);
ERR_CONTINUE(idx == -1);
- String full_path = ia.dir->get_file_path(idx);
- const EditorFileSystemDirectory::FileInfo *fi = ia.dir->files[idx];
- if (ClassDB::is_parent_class(fi->type, SNAME("Script"))) {
- _queue_update_script_class(full_path, fi->type, fi->script_class_name, fi->script_class_extends, fi->script_class_icon_path);
- }
- if (fi->type == SNAME("PackedScene")) {
- _queue_update_scene_groups(full_path);
+ // Only reloads the resources that are already loaded.
+ if (ResourceCache::has(ia.dir->get_file_path(idx))) {
+ reloads.push_back(ia.dir->get_file_path(idx));
}
-
- reloads.push_back(full_path);
-
} break;
}
@@ -841,7 +835,7 @@ bool EditorFileSystem::_update_scan_actions() {
}
}
- if (reimports.size()) {
+ if (!reimports.is_empty()) {
if (_scan_import_support(reimports)) {
return true;
}
@@ -852,6 +846,11 @@ bool EditorFileSystem::_update_scan_actions() {
ResourceUID::get_singleton()->update_cache();
}
+ if (!reloads.is_empty()) {
+ // Update global class names, dependencies, etc...
+ update_files(reloads);
+ }
+
if (first_scan) {
//only on first scan this is valid and updated, then settings changed.
revalidate_import_files = false;
@@ -1341,8 +1340,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, ScanPr
ia.file = p_dir->files[i]->file;
scan_actions.push_back(ia);
}
- } else if (ResourceCache::has(path)) { //test for potential reload
-
+ } else {
uint64_t mt = FileAccess::get_modified_time(path);
if (mt != p_dir->files[i]->modified_time) {
@@ -1967,6 +1965,14 @@ void EditorFileSystem::_update_script_documentation() {
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
ScriptLanguage *lang = ScriptServer::get_language(i);
if (lang->supports_documentation() && efd->files[index]->type == lang->get_type()) {
+ // Reloading the script from disk if resource already in memory. Otherwise, the
+ // ResourceLoader::load will return the last loaded version of the script (without the modifications).
+ // The only have the script already loaded here is to edit the script outside the
+ // editor without being connected to the LSP server.
+ Ref<Resource> res = ResourceCache::get_ref(path);
+ if (res.is_valid()) {
+ res->reload_from_file();
+ }
Ref<Script> scr = ResourceLoader::load(path);
if (scr.is_null()) {
continue;
@@ -1974,6 +1980,10 @@ void EditorFileSystem::_update_script_documentation() {
Vector<DocData::ClassDoc> docs = scr->get_documentation();
for (int j = 0; j < docs.size(); j++) {
EditorHelp::get_doc_data()->add_doc(docs[j]);
+ if (!first_scan) {
+ // Update the documentation in the Script Editor if it is open.
+ ScriptEditor::get_singleton()->update_doc(docs[j].name);
+ }
}
}
}
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 276a12f5de..4d56fcb846 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -880,6 +880,11 @@ Error GDScript::reload(bool p_keep_state) {
if (can_run && p_keep_state) {
_restore_old_static_data();
}
+
+ if (p_keep_state) {
+ // Update the properties in the inspector.
+ update_exports();
+ }
#endif
reloading = false;
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index fa5f279db9..e848d4f5ef 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -485,8 +485,6 @@ GDScriptTextDocument::GDScriptTextDocument() {
void GDScriptTextDocument::sync_script_content(const String &p_path, const String &p_content) {
String path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(p_path);
GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_script(path, p_content);
-
- EditorFileSystem::get_singleton()->update_file(path);
}
void GDScriptTextDocument::show_native_symbol_in_editor(const String &p_symbol_id) {