Open Gallilus opened 3 years ago
NavigationMeshGenerator
singleton is not displayed green.
This is because NavigationMeshGenerator
is not a class name, as the class of that singleton property is actually EditorNavigationMeshGenerator
. That's the only case of a discrepancy between the singleton name and the class name, which is why it's the only one not displayed correctly.
The syntax highlighter should likely have custom code to handle singletons specifically, and not just classes.
GDScriptLanguageProtocol
singleton Identifier not found: GDScriptLanguageProtocol
That one is weird as it seems to be properly registered as singleton. It's registered in the Core API when it should likely be in the Editor API only (only available in tool
scripts), which can be fixed with this patch:
diff --git a/modules/gdscript/language_server/gdscript_language_server.cpp b/modules/gdscript/language_server/gdscript_language_server.cpp
index 12ed56a568..63b305ad82 100644
--- a/modules/gdscript/language_server/gdscript_language_server.cpp
+++ b/modules/gdscript/language_server/gdscript_language_server.cpp
@@ -106,7 +106,9 @@ void GDScriptLanguageServer::stop() {
}
void register_lsp_types() {
+ ClassDB::set_current_api(ClassDB::API_EDITOR);
ClassDB::register_class<GDScriptLanguageProtocol>();
ClassDB::register_class<GDScriptTextDocument>();
ClassDB::register_class<GDScriptWorkspace>();
+ ClassDB::set_current_api(ClassDB::API_CORE);
}
But that doesn't solve the GDScript error when trying to use the identifier in a tool
script. Maybe the registration happens too late? CC @vnen
The GDScriptLanguageProtocol
issue is valid in master
too.
The NavigationMeshGenerator
highlighting seems solved in master
(the class was renamed) and should thus likely not be fixed in 3.4 which would break compat.
There's now an issue with VisualScriptEditor
similar to NavigationMeshGenerator
, because the class was renamed and not the singleton (see #51916 and follow-ups, CC @mhilbrunner).
There's now an issue with
VisualScriptEditor
similar toNavigationMeshGenerator
, because the class was renamed and not the singleton (see #51916 and follow-ups, CC @mhilbrunner).
This is fixed by #52656, so I repurposed this issue to focus only on the GDScriptLanguageProtocol
issue.
It seems the issue is that this class and its singleton are registered in the _editor_init()
callback:
But this is called quite late, which makes it doesn't appear on the editor help for instance. When running the project this is never called so the class don't get registered all, hence the error.
This registration code should probably be moved to the register_gdscript_types()
function.
Godot version
3.4.beta3
System information
Windows 10
Issue description
NavigationMeshGenerator
singleton is not displayed green.GDScriptLanguageProtocol
singleton Identifier not found: GDScriptLanguageProtocolSteps to reproduce
Minimal reproduction project
N-A