diff options
| author | Ignacio Roldán Etcheverry <ignalfonsore@gmail.com> | 2023-07-02 03:26:14 +0200 |
|---|---|---|
| committer | Ignacio Roldán Etcheverry <ignalfonsore@gmail.com> | 2023-07-02 03:48:15 +0200 |
| commit | 22aad32c69de6ef500ba8327bb9b8a09c071f45e (patch) | |
| tree | d6aad48c9e3bedc3ac74909c6d578997d935da8c | |
| parent | 46424488edc341b65467ee7fd3ac423e4d49ad34 (diff) | |
| download | redot-engine-22aad32c69de6ef500ba8327bb9b8a09c071f45e.tar.gz | |
C#: Fix NodePaths completion error for not calling from main thread
The node API we use for code completion changed and no longer allows
being called from threads other than the main one.
| -rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs index 62db6e3af5..51c7a8aa22 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs @@ -385,9 +385,12 @@ namespace GodotTools.Ides // However, it doesn't fix resource loading if the rest of the path is also case insensitive. string scriptFileLocalized = FsPathUtils.LocalizePathWithCaseChecked(request.ScriptFile); + // The node API can only be called from the main thread. + await Godot.Engine.GetMainLoop().ToSignal(Godot.Engine.GetMainLoop(), "process_frame"); + var response = new CodeCompletionResponse { Kind = request.Kind, ScriptFile = request.ScriptFile }; - response.Suggestions = await Task.Run(() => - Internal.CodeCompletionRequest(response.Kind, scriptFileLocalized ?? request.ScriptFile)); + response.Suggestions = Internal.CodeCompletionRequest(response.Kind, + scriptFileLocalized ?? request.ScriptFile); return response; } } |
