Commit 8dd330d 1 parent 77dcf97 commit 8dd330d Copy full SHA for 8dd330d
File tree 2 files changed +15
-3
lines changed
modules/gdscript/language_server
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,21 @@ void GDScriptTextDocument::didSave(const Variant &p_param) {
112
112
}
113
113
114
114
scr->update_exports ();
115
- ScriptEditor::get_singleton ()->reload_scripts (true );
116
- ScriptEditor::get_singleton ()->update_docs_from_script (scr);
117
- ScriptEditor::get_singleton ()->trigger_live_script_reload (scr->get_path ());
115
+
116
+ if (!Thread::is_main_thread ()) {
117
+ callable_mp (this , &GDScriptTextDocument::reload_script).call_deferred (scr);
118
+ } else {
119
+ reload_script (scr);
120
+ }
118
121
}
119
122
}
120
123
124
+ void GDScriptTextDocument::reload_script (Ref<GDScript> p_to_reload_script) {
125
+ ScriptEditor::get_singleton ()->reload_scripts (true );
126
+ ScriptEditor::get_singleton ()->update_docs_from_script (p_to_reload_script);
127
+ ScriptEditor::get_singleton ()->trigger_live_script_reload (p_to_reload_script->get_path ());
128
+ }
129
+
121
130
lsp::TextDocumentItem GDScriptTextDocument::load_document_item (const Variant &p_param) {
122
131
lsp::TextDocumentItem doc;
123
132
Dictionary params = p_param;
Original file line number Diff line number Diff line change 36
36
#include " core/io/file_access.h"
37
37
#include " core/object/ref_counted.h"
38
38
39
+ class GDScript ;
40
+
39
41
class GDScriptTextDocument : public RefCounted {
40
42
GDCLASS (GDScriptTextDocument, RefCounted)
41
43
protected:
@@ -49,6 +51,7 @@ class GDScriptTextDocument : public RefCounted {
49
51
void willSaveWaitUntil (const Variant &p_param);
50
52
void didSave (const Variant &p_param);
51
53
54
+ void reload_script (Ref<GDScript> p_to_reload_script);
52
55
void sync_script_content (const String &p_path, const String &p_content);
53
56
void show_native_symbol_in_editor (const String &p_symbol_id);
54
57
You can’t perform that action at this time.
0 commit comments