Merge pull request #78928 from neikeq/issue-78913

C#: Fix NodePaths completion error for not calling from main thread
This commit is contained in:
Rémi Verschelde 2023-07-03 15:51:30 +02:00 committed by GitHub
commit e044e13d5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}
}