From 47bc8f002f4c64cb86fa21fc5dd0c4b0477f900d Mon Sep 17 00:00:00 2001 From: HolonProduction Date: Mon, 16 Feb 2026 20:00:21 +0100 Subject: [PATCH] LSP: Fix singleton registration --- doc/classes/@GlobalScope.xml | 4 ++++ editor/doc/doc_tools.cpp | 2 +- modules/gdscript/register_types.cpp | 10 ++++------ tests/core/object/test_class_db.h | 3 --- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index c3a35e6adf..5ad74764c0 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1572,6 +1572,10 @@ The [GDExtensionManager] singleton. + + The [GDScriptLanguageProtocol] singleton. + [b]Note:[/b] Only available in editor builds. + The [Geometry2D] singleton. diff --git a/editor/doc/doc_tools.cpp b/editor/doc/doc_tools.cpp index db074b9373..e8fcced165 100644 --- a/editor/doc/doc_tools.cpp +++ b/editor/doc/doc_tools.cpp @@ -988,7 +988,7 @@ void DocTools::generate(BitField p_flags) { } pd.name = s.name; pd.type = s.ptr->get_class(); - while (String(ClassDB::get_parent_class(pd.type)) != "Object") { + while (!ClassDB::is_class_exposed(pd.type)) { pd.type = ClassDB::get_parent_class(pd.type); } c.properties.push_back(pd); diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 3ca31117be..00a69d9175 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -126,12 +126,6 @@ static void _editor_init() { gdscript_syntax_highlighter.instantiate(); ScriptEditor::get_singleton()->register_syntax_highlighter(gdscript_syntax_highlighter); #endif - -#ifndef GDSCRIPT_NO_LSP - Engine::Singleton singleton("GDScriptLanguageProtocol", GDScriptLanguageProtocol::get_singleton()); - singleton.editor_only = true; - Engine::get_singleton()->add_singleton(singleton); -#endif // !GDSCRIPT_NO_LSP } #endif // TOOLS_ENABLED @@ -166,6 +160,10 @@ void initialize_gdscript_module(ModuleInitializationLevel p_level) { register_lsp_types(); memnew(GDScriptLanguageProtocol); EditorPlugins::add_by_type(); + + Engine::Singleton singleton("GDScriptLanguageProtocol", GDScriptLanguageProtocol::get_singleton()); + singleton.editor_only = true; + Engine::get_singleton()->add_singleton(singleton); #endif // !GDSCRIPT_NO_LSP } #endif // TOOLS_ENABLED diff --git a/tests/core/object/test_class_db.h b/tests/core/object/test_class_db.h index 012279c0c1..39400ccd7f 100644 --- a/tests/core/object/test_class_db.h +++ b/tests/core/object/test_class_db.h @@ -496,9 +496,6 @@ void validate_class(const Context &p_context, const ExposedClass &p_exposed_clas "Object class is registered as a singleton."); } - TEST_FAIL_COND((p_exposed_class.is_singleton && p_exposed_class.base != p_context.names_cache.object_class), - "Singleton base class '", String(p_exposed_class.base), "' is not Object, for class '", p_exposed_class.name, "'."); - TEST_FAIL_COND((is_derived_type && !p_context.exposed_classes.has(p_exposed_class.base)), "Base type '", p_exposed_class.base.operator String(), "' does not exist, for class '", p_exposed_class.name, "'.");