Skip to content

Commit 3769034

Browse files
committed
Merge pull request godotengine#116369 from HolonProduction/lsp/singleton
LSP: Fix singleton registration
2 parents 5866e4f + 47bc8f0 commit 3769034

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

doc/classes/@GlobalScope.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,10 @@
15721572
<member name="GDExtensionManager" type="GDExtensionManager" setter="" getter="">
15731573
The [GDExtensionManager] singleton.
15741574
</member>
1575+
<member name="GDScriptLanguageProtocol" type="GDScriptLanguageProtocol" setter="" getter="">
1576+
The [GDScriptLanguageProtocol] singleton.
1577+
[b]Note:[/b] Only available in editor builds.
1578+
</member>
15751579
<member name="Geometry2D" type="Geometry2D" setter="" getter="">
15761580
The [Geometry2D] singleton.
15771581
</member>

editor/doc/doc_tools.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ void DocTools::generate(BitField<GenerateFlags> p_flags) {
988988
}
989989
pd.name = s.name;
990990
pd.type = s.ptr->get_class();
991-
while (String(ClassDB::get_parent_class(pd.type)) != "Object") {
991+
while (!ClassDB::is_class_exposed(pd.type)) {
992992
pd.type = ClassDB::get_parent_class(pd.type);
993993
}
994994
c.properties.push_back(pd);

modules/gdscript/register_types.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@ static void _editor_init() {
126126
gdscript_syntax_highlighter.instantiate();
127127
ScriptEditor::get_singleton()->register_syntax_highlighter(gdscript_syntax_highlighter);
128128
#endif
129-
130-
#ifndef GDSCRIPT_NO_LSP
131-
Engine::Singleton singleton("GDScriptLanguageProtocol", GDScriptLanguageProtocol::get_singleton());
132-
singleton.editor_only = true;
133-
Engine::get_singleton()->add_singleton(singleton);
134-
#endif // !GDSCRIPT_NO_LSP
135129
}
136130

137131
#endif // TOOLS_ENABLED
@@ -166,6 +160,10 @@ void initialize_gdscript_module(ModuleInitializationLevel p_level) {
166160
register_lsp_types();
167161
memnew(GDScriptLanguageProtocol);
168162
EditorPlugins::add_by_type<GDScriptLanguageServer>();
163+
164+
Engine::Singleton singleton("GDScriptLanguageProtocol", GDScriptLanguageProtocol::get_singleton());
165+
singleton.editor_only = true;
166+
Engine::get_singleton()->add_singleton(singleton);
169167
#endif // !GDSCRIPT_NO_LSP
170168
}
171169
#endif // TOOLS_ENABLED

tests/core/object/test_class_db.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,6 @@ void validate_class(const Context &p_context, const ExposedClass &p_exposed_clas
496496
"Object class is registered as a singleton.");
497497
}
498498

499-
TEST_FAIL_COND((p_exposed_class.is_singleton && p_exposed_class.base != p_context.names_cache.object_class),
500-
"Singleton base class '", String(p_exposed_class.base), "' is not Object, for class '", p_exposed_class.name, "'.");
501-
502499
TEST_FAIL_COND((is_derived_type && !p_context.exposed_classes.has(p_exposed_class.base)),
503500
"Base type '", p_exposed_class.base.operator String(), "' does not exist, for class '", p_exposed_class.name, "'.");
504501

0 commit comments

Comments
 (0)