diff --git a/core/core_bind.compat.inc b/core/core_bind.compat.inc index efc9acc72fb..8bfa66e4b7d 100644 --- a/core/core_bind.compat.inc +++ b/core/core_bind.compat.inc @@ -30,7 +30,7 @@ #ifndef DISABLE_DEPRECATED -namespace core_bind { +namespace CoreBind { // Semaphore @@ -59,6 +59,6 @@ void OS::_bind_compatibility_methods() { ClassDB::bind_compatibility_method(D_METHOD("execute_with_pipe", "path", "arguments"), &OS::_execute_with_pipe_bind_compat_94434); } -} // namespace core_bind +} // namespace CoreBind #endif // DISABLE_DEPRECATED diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 8b2de00c193..12fc0659407 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -42,7 +42,7 @@ #include "core/os/thread_safe.h" #include "core/variant/typed_array.h" -namespace core_bind { +namespace CoreBind { ////// ResourceLoader ////// @@ -1422,7 +1422,7 @@ void Thread::_bind_methods() { BIND_ENUM_CONSTANT(PRIORITY_HIGH); } -namespace special { +namespace Special { ////// ClassDB ////// @@ -1749,7 +1749,7 @@ void ClassDB::_bind_methods() { BIND_ENUM_CONSTANT(API_NONE); } -} // namespace special +} // namespace Special ////// Engine ////// @@ -2193,4 +2193,4 @@ void EngineDebugger::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_breakpoints"), &EngineDebugger::clear_breakpoints); } -} // namespace core_bind +} // namespace CoreBind diff --git a/core/core_bind.h b/core/core_bind.h index 76cc420393a..ec74c53d5a0 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -41,7 +41,7 @@ class MainLoop; template class TypedArray; -namespace core_bind { +namespace CoreBind { class ResourceLoader : public Object { GDCLASS(ResourceLoader, Object); @@ -457,7 +457,7 @@ public: static void set_thread_safety_checks_enabled(bool p_enabled); }; -namespace special { +namespace Special { class ClassDB : public Object { GDCLASS(ClassDB, Object); @@ -523,7 +523,7 @@ public: ~ClassDB() {} }; -} // namespace special +} // namespace Special class Engine : public Object { GDCLASS(Engine, Object); @@ -651,21 +651,21 @@ public: ~EngineDebugger(); }; -} // namespace core_bind +} // namespace CoreBind -VARIANT_ENUM_CAST(core_bind::ResourceLoader::ThreadLoadStatus); -VARIANT_ENUM_CAST(core_bind::ResourceLoader::CacheMode); +VARIANT_ENUM_CAST(CoreBind::ResourceLoader::ThreadLoadStatus); +VARIANT_ENUM_CAST(CoreBind::ResourceLoader::CacheMode); -VARIANT_BITFIELD_CAST(core_bind::ResourceSaver::SaverFlags); +VARIANT_BITFIELD_CAST(CoreBind::ResourceSaver::SaverFlags); -VARIANT_ENUM_CAST(core_bind::OS::RenderingDriver); -VARIANT_ENUM_CAST(core_bind::OS::SystemDir); -VARIANT_ENUM_CAST(core_bind::OS::StdHandleType); +VARIANT_ENUM_CAST(CoreBind::OS::RenderingDriver); +VARIANT_ENUM_CAST(CoreBind::OS::SystemDir); +VARIANT_ENUM_CAST(CoreBind::OS::StdHandleType); -VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyBooleanOperation); -VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyJoinType); -VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyEndType); +VARIANT_ENUM_CAST(CoreBind::Geometry2D::PolyBooleanOperation); +VARIANT_ENUM_CAST(CoreBind::Geometry2D::PolyJoinType); +VARIANT_ENUM_CAST(CoreBind::Geometry2D::PolyEndType); -VARIANT_ENUM_CAST(core_bind::Thread::Priority); +VARIANT_ENUM_CAST(CoreBind::Thread::Priority); -VARIANT_ENUM_CAST(core_bind::special::ClassDB::APIType); +VARIANT_ENUM_CAST(CoreBind::Special::ClassDB::APIType); diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 8dc0bd3f6e6..b7b009a6a45 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -905,8 +905,8 @@ Ref ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Erro } } if (!import_thread) { // Main thread is blocked by initial resource reimport, do not wait. - core_bind::Semaphore done; - MessageQueue::get_main_singleton()->push_callable(callable_mp(&done, &core_bind::Semaphore::post).bind(1)); + CoreBind::Semaphore done; + MessageQueue::get_main_singleton()->push_callable(callable_mp(&done, &CoreBind::Semaphore::post).bind(1)); done.wait(); } } diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index 18f1f42817c..189f000ee60 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -35,7 +35,7 @@ #include "core/object/worker_thread_pool.h" #include "core/os/thread.h" -namespace core_bind { +namespace CoreBind { class ResourceLoader; } @@ -104,7 +104,7 @@ typedef void (*ResourceLoadedCallback)(Ref p_resource, const String &p class ResourceLoader { friend class LoadToken; - friend class core_bind::ResourceLoader; + friend class CoreBind::ResourceLoader; enum { MAX_LOADERS = 64 diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index b4fb7c24bf9..d76ebc2a356 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -92,19 +92,19 @@ static Ref resource_loader_gdextension; static Ref resource_saver_json; static Ref resource_loader_json; -static core_bind::ResourceLoader *_resource_loader = nullptr; -static core_bind::ResourceSaver *_resource_saver = nullptr; -static core_bind::OS *_os = nullptr; -static core_bind::Engine *_engine = nullptr; -static core_bind::special::ClassDB *_classdb = nullptr; -static core_bind::Marshalls *_marshalls = nullptr; -static core_bind::EngineDebugger *_engine_debugger = nullptr; +static CoreBind::ResourceLoader *_resource_loader = nullptr; +static CoreBind::ResourceSaver *_resource_saver = nullptr; +static CoreBind::OS *_os = nullptr; +static CoreBind::Engine *_engine = nullptr; +static CoreBind::Special::ClassDB *_classdb = nullptr; +static CoreBind::Marshalls *_marshalls = nullptr; +static CoreBind::EngineDebugger *_engine_debugger = nullptr; static IP *ip = nullptr; static Time *_time = nullptr; -static core_bind::Geometry2D *_geometry_2d = nullptr; -static core_bind::Geometry3D *_geometry_3d = nullptr; +static CoreBind::Geometry2D *_geometry_2d = nullptr; +static CoreBind::Geometry3D *_geometry_3d = nullptr; static WorkerThreadPool *worker_thread_pool = nullptr; @@ -251,9 +251,9 @@ void register_core_types() { GDREGISTER_ABSTRACT_CLASS(FileAccess); GDREGISTER_ABSTRACT_CLASS(DirAccess); - GDREGISTER_CLASS(core_bind::Thread); - GDREGISTER_CLASS(core_bind::Mutex); - GDREGISTER_CLASS(core_bind::Semaphore); + GDREGISTER_CLASS(CoreBind::Thread); + GDREGISTER_CLASS(CoreBind::Mutex); + GDREGISTER_CLASS(CoreBind::Semaphore); GDREGISTER_CLASS(XMLParser); GDREGISTER_CLASS(JSON); @@ -293,16 +293,16 @@ void register_core_types() { ip = IP::create(); - _geometry_2d = memnew(core_bind::Geometry2D); - _geometry_3d = memnew(core_bind::Geometry3D); + _geometry_2d = memnew(CoreBind::Geometry2D); + _geometry_3d = memnew(CoreBind::Geometry3D); - _resource_loader = memnew(core_bind::ResourceLoader); - _resource_saver = memnew(core_bind::ResourceSaver); - _os = memnew(core_bind::OS); - _engine = memnew(core_bind::Engine); - _classdb = memnew(core_bind::special::ClassDB); - _marshalls = memnew(core_bind::Marshalls); - _engine_debugger = memnew(core_bind::EngineDebugger); + _resource_loader = memnew(CoreBind::ResourceLoader); + _resource_saver = memnew(CoreBind::ResourceSaver); + _os = memnew(CoreBind::OS); + _engine = memnew(CoreBind::Engine); + _classdb = memnew(CoreBind::Special::ClassDB); + _marshalls = memnew(CoreBind::Marshalls); + _engine_debugger = memnew(CoreBind::EngineDebugger); GDREGISTER_NATIVE_STRUCT(ObjectID, "uint64_t id = 0"); GDREGISTER_NATIVE_STRUCT(AudioFrame, "float left;float right"); @@ -324,14 +324,14 @@ void register_core_settings() { } void register_early_core_singletons() { - GDREGISTER_CLASS(core_bind::Engine); - Engine::get_singleton()->add_singleton(Engine::Singleton("Engine", core_bind::Engine::get_singleton())); + GDREGISTER_CLASS(CoreBind::Engine); + Engine::get_singleton()->add_singleton(Engine::Singleton("Engine", CoreBind::Engine::get_singleton())); GDREGISTER_CLASS(ProjectSettings); Engine::get_singleton()->add_singleton(Engine::Singleton("ProjectSettings", ProjectSettings::get_singleton())); - GDREGISTER_CLASS(core_bind::OS); - Engine::get_singleton()->add_singleton(Engine::Singleton("OS", core_bind::OS::get_singleton())); + GDREGISTER_CLASS(CoreBind::OS); + Engine::get_singleton()->add_singleton(Engine::Singleton("OS", CoreBind::OS::get_singleton())); GDREGISTER_CLASS(Time); Engine::get_singleton()->add_singleton(Engine::Singleton("Time", Time::get_singleton())); @@ -341,29 +341,29 @@ void register_core_singletons() { OS::get_singleton()->benchmark_begin_measure("Core", "Register Singletons"); GDREGISTER_ABSTRACT_CLASS(IP); - GDREGISTER_CLASS(core_bind::Geometry2D); - GDREGISTER_CLASS(core_bind::Geometry3D); - GDREGISTER_CLASS(core_bind::ResourceLoader); - GDREGISTER_CLASS(core_bind::ResourceSaver); - GDREGISTER_CLASS(core_bind::special::ClassDB); - GDREGISTER_CLASS(core_bind::Marshalls); + GDREGISTER_CLASS(CoreBind::Geometry2D); + GDREGISTER_CLASS(CoreBind::Geometry3D); + GDREGISTER_CLASS(CoreBind::ResourceLoader); + GDREGISTER_CLASS(CoreBind::ResourceSaver); + GDREGISTER_CLASS(CoreBind::Special::ClassDB); + GDREGISTER_CLASS(CoreBind::Marshalls); GDREGISTER_CLASS(TranslationServer); GDREGISTER_ABSTRACT_CLASS(Input); GDREGISTER_CLASS(InputMap); GDREGISTER_CLASS(Expression); - GDREGISTER_CLASS(core_bind::EngineDebugger); + GDREGISTER_CLASS(CoreBind::EngineDebugger); Engine::get_singleton()->add_singleton(Engine::Singleton("IP", IP::get_singleton(), "IP")); - Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry2D", core_bind::Geometry2D::get_singleton())); - Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry3D", core_bind::Geometry3D::get_singleton())); - Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceLoader", core_bind::ResourceLoader::get_singleton())); - Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceSaver", core_bind::ResourceSaver::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry2D", CoreBind::Geometry2D::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry3D", CoreBind::Geometry3D::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceLoader", CoreBind::ResourceLoader::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceSaver", CoreBind::ResourceSaver::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("ClassDB", _classdb)); - Engine::get_singleton()->add_singleton(Engine::Singleton("Marshalls", core_bind::Marshalls::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("Marshalls", CoreBind::Marshalls::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("TranslationServer", TranslationServer::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("Input", Input::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("InputMap", InputMap::get_singleton())); - Engine::get_singleton()->add_singleton(Engine::Singleton("EngineDebugger", core_bind::EngineDebugger::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("EngineDebugger", CoreBind::EngineDebugger::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("GDExtensionManager", GDExtensionManager::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceUID", ResourceUID::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("WorkerThreadPool", worker_thread_pool)); diff --git a/core/variant/type_info.h b/core/variant/type_info.h index 48277b18779..2781f61da89 100644 --- a/core/variant/type_info.h +++ b/core/variant/type_info.h @@ -209,8 +209,8 @@ struct GetTypeInfo>> { } }; -namespace godot { -namespace details { +namespace GodotTypeInfo { +namespace Internal { inline String enum_qualified_name_to_class_info_name(const String &p_qualified_name) { Vector parts = p_qualified_name.split("::", false); if (parts.size() <= 2) { @@ -219,8 +219,8 @@ inline String enum_qualified_name_to_class_info_name(const String &p_qualified_n // Contains namespace. We only want the class and enum names. return parts[parts.size() - 2] + "." + parts[parts.size() - 1]; } -} // namespace details -} // namespace godot +} // namespace Internal +} // namespace GodotTypeInfo #define TEMPL_MAKE_ENUM_TYPE_INFO(m_enum, m_impl) \ template <> \ @@ -229,7 +229,7 @@ inline String enum_qualified_name_to_class_info_name(const String &p_qualified_n static const GodotTypeInfo::Metadata METADATA = GodotTypeInfo::METADATA_NONE; \ static inline PropertyInfo get_class_info() { \ return PropertyInfo(Variant::INT, String(), PROPERTY_HINT_NONE, String(), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CLASS_IS_ENUM, \ - godot::details::enum_qualified_name_to_class_info_name(String(#m_enum))); \ + GodotTypeInfo::Internal::enum_qualified_name_to_class_info_name(String(#m_enum))); \ } \ }; @@ -278,7 +278,7 @@ struct is_zero_constructible> : std::true_type {}; static const GodotTypeInfo::Metadata METADATA = GodotTypeInfo::METADATA_NONE; \ static inline PropertyInfo get_class_info() { \ return PropertyInfo(Variant::INT, String(), PROPERTY_HINT_NONE, String(), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CLASS_IS_BITFIELD, \ - godot::details::enum_qualified_name_to_class_info_name(String(#m_enum))); \ + GodotTypeInfo::Internal::enum_qualified_name_to_class_info_name(String(#m_enum))); \ } \ }; \ template <> \ @@ -287,7 +287,7 @@ struct is_zero_constructible> : std::true_type {}; static const GodotTypeInfo::Metadata METADATA = GodotTypeInfo::METADATA_NONE; \ static inline PropertyInfo get_class_info() { \ return PropertyInfo(Variant::INT, String(), PROPERTY_HINT_NONE, String(), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CLASS_IS_BITFIELD, \ - godot::details::enum_qualified_name_to_class_info_name(String(#m_enum))); \ + GodotTypeInfo::Internal::enum_qualified_name_to_class_info_name(String(#m_enum))); \ } \ }; diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp index 3f55cb44383..0c2c5912c4d 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.cpp +++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp @@ -44,8 +44,8 @@ int get_indent_size() { } } -lsp::Position GodotPosition::to_lsp(const Vector &p_lines) const { - lsp::Position res; +LSP::Position GodotPosition::to_lsp(const Vector &p_lines) const { + LSP::Position res; // Special case: `line = 0` -> root class (range covers everything). if (line <= 0) { @@ -89,7 +89,7 @@ lsp::Position GodotPosition::to_lsp(const Vector &p_lines) const { return res; } -GodotPosition GodotPosition::from_lsp(const lsp::Position p_pos, const Vector &p_lines) { +GodotPosition GodotPosition::from_lsp(const LSP::Position p_pos, const Vector &p_lines) { GodotPosition res(p_pos.line + 1, p_pos.character + 1); // Line outside of actual text is valid (-> pos/cursor at end of text). @@ -113,14 +113,14 @@ GodotPosition GodotPosition::from_lsp(const lsp::Position p_pos, const Vector &p_lines) const { - lsp::Range res; +LSP::Range GodotRange::to_lsp(const Vector &p_lines) const { + LSP::Range res; res.start = start.to_lsp(p_lines); res.end = end.to_lsp(p_lines); return res; } -GodotRange GodotRange::from_lsp(const lsp::Range &p_range, const Vector &p_lines) { +GodotRange GodotRange::from_lsp(const LSP::Range &p_range, const Vector &p_lines) { GodotPosition start = GodotPosition::from_lsp(p_range.start, p_lines); GodotPosition end = GodotPosition::from_lsp(p_range.end, p_lines); return GodotRange(start, end); @@ -131,13 +131,13 @@ void ExtendGDScriptParser::update_diagnostics() { const List &parser_errors = get_errors(); for (const ParserError &error : parser_errors) { - lsp::Diagnostic diagnostic; - diagnostic.severity = lsp::DiagnosticSeverity::Error; + LSP::Diagnostic diagnostic; + diagnostic.severity = LSP::DiagnosticSeverity::Error; diagnostic.message = error.message; diagnostic.source = "gdscript"; diagnostic.code = -1; - lsp::Range range; - lsp::Position pos; + LSP::Range range; + LSP::Position pos; const PackedStringArray line_array = get_lines(); int line = CLAMP(LINE_NUMBER_TO_INDEX(error.line), 0, line_array.size() - 1); const String &line_text = line_array[line]; @@ -152,13 +152,13 @@ void ExtendGDScriptParser::update_diagnostics() { const List &parser_warnings = get_warnings(); for (const GDScriptWarning &warning : parser_warnings) { - lsp::Diagnostic diagnostic; - diagnostic.severity = lsp::DiagnosticSeverity::Warning; + LSP::Diagnostic diagnostic; + diagnostic.severity = LSP::DiagnosticSeverity::Warning; diagnostic.message = "(" + warning.get_name() + "): " + warning.get_message(); diagnostic.source = "gdscript"; diagnostic.code = warning.code; - lsp::Range range; - lsp::Position pos; + LSP::Range range; + LSP::Position pos; int line = LINE_NUMBER_TO_INDEX(warning.start_line); const String &line_text = get_lines()[line]; pos.line = line; @@ -178,14 +178,14 @@ void ExtendGDScriptParser::update_symbols() { parse_class_symbol(gdclass, class_symbol); for (int i = 0; i < class_symbol.children.size(); i++) { - const lsp::DocumentSymbol &symbol = class_symbol.children[i]; + const LSP::DocumentSymbol &symbol = class_symbol.children[i]; members.insert(symbol.name, &symbol); // Cache level one inner classes. - if (symbol.kind == lsp::SymbolKind::Class) { + if (symbol.kind == LSP::SymbolKind::Class) { ClassMembers inner_class; for (int j = 0; j < symbol.children.size(); j++) { - const lsp::DocumentSymbol &s = symbol.children[j]; + const LSP::DocumentSymbol &s = symbol.children[j]; inner_class.insert(s.name, &s); } inner_classes.insert(symbol.name, inner_class); @@ -215,7 +215,7 @@ void ExtendGDScriptParser::update_document_links(const String &p_code) { } if (exists) { String value = const_val; - lsp::DocumentLink link; + LSP::DocumentLink link; link.target = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_uri(scr_path); link.range = GodotRange(GodotPosition(token.start_line, token.start_column), GodotPosition(token.end_line, token.end_column)).to_lsp(lines); document_links.push_back(link); @@ -225,13 +225,13 @@ void ExtendGDScriptParser::update_document_links(const String &p_code) { } } -lsp::Range ExtendGDScriptParser::range_of_node(const GDScriptParser::Node *p_node) const { +LSP::Range ExtendGDScriptParser::range_of_node(const GDScriptParser::Node *p_node) const { GodotPosition start(p_node->start_line, p_node->start_column); GodotPosition end(p_node->end_line, p_node->end_column); return GodotRange(start, end).to_lsp(lines); } -void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p_class, lsp::DocumentSymbol &r_symbol) { +void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p_class, LSP::DocumentSymbol &r_symbol) { const String uri = get_uri(); r_symbol.uri = uri; @@ -241,7 +241,7 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p if (r_symbol.name.is_empty()) { r_symbol.name = path.get_file(); } - r_symbol.kind = lsp::SymbolKind::Class; + r_symbol.kind = LSP::SymbolKind::Class; r_symbol.deprecated = false; r_symbol.range = range_of_node(p_class); if (p_class->identifier) { @@ -276,9 +276,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p switch (m.type) { case ClassNode::Member::VARIABLE: { - lsp::DocumentSymbol symbol; + LSP::DocumentSymbol symbol; symbol.name = m.variable->identifier->name; - symbol.kind = m.variable->property == VariableNode::PROP_NONE ? lsp::SymbolKind::Variable : lsp::SymbolKind::Property; + symbol.kind = m.variable->property == VariableNode::PROP_NONE ? LSP::SymbolKind::Variable : LSP::SymbolKind::Property; symbol.deprecated = false; symbol.range = range_of_node(m.variable); symbol.selectionRange = range_of_node(m.variable->identifier); @@ -299,20 +299,20 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p if (m.variable->initializer && m.variable->initializer->type == GDScriptParser::Node::LAMBDA) { GDScriptParser::LambdaNode *lambda_node = (GDScriptParser::LambdaNode *)m.variable->initializer; - lsp::DocumentSymbol lambda; + LSP::DocumentSymbol lambda; parse_function_symbol(lambda_node->function, lambda); // Merge lambda into current variable. symbol.children.append_array(lambda.children); } if (m.variable->getter && m.variable->getter->type == GDScriptParser::Node::FUNCTION) { - lsp::DocumentSymbol get_symbol; + LSP::DocumentSymbol get_symbol; parse_function_symbol(m.variable->getter, get_symbol); get_symbol.local = true; symbol.children.push_back(get_symbol); } if (m.variable->setter && m.variable->setter->type == GDScriptParser::Node::FUNCTION) { - lsp::DocumentSymbol set_symbol; + LSP::DocumentSymbol set_symbol; parse_function_symbol(m.variable->setter, set_symbol); set_symbol.local = true; symbol.children.push_back(set_symbol); @@ -321,10 +321,10 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p r_symbol.children.push_back(symbol); } break; case ClassNode::Member::CONSTANT: { - lsp::DocumentSymbol symbol; + LSP::DocumentSymbol symbol; symbol.name = m.constant->identifier->name; - symbol.kind = lsp::SymbolKind::Constant; + symbol.kind = LSP::SymbolKind::Constant; symbol.deprecated = false; symbol.range = range_of_node(m.constant); symbol.selectionRange = range_of_node(m.constant->identifier); @@ -361,9 +361,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p r_symbol.children.push_back(symbol); } break; case ClassNode::Member::SIGNAL: { - lsp::DocumentSymbol symbol; + LSP::DocumentSymbol symbol; symbol.name = m.signal->identifier->name; - symbol.kind = lsp::SymbolKind::Event; + symbol.kind = LSP::SymbolKind::Event; symbol.deprecated = false; symbol.range = range_of_node(m.signal); symbol.selectionRange = range_of_node(m.signal->identifier); @@ -380,9 +380,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p symbol.detail += ")"; for (GDScriptParser::ParameterNode *param : m.signal->parameters) { - lsp::DocumentSymbol param_symbol; + LSP::DocumentSymbol param_symbol; param_symbol.name = param->identifier->name; - param_symbol.kind = lsp::SymbolKind::Variable; + param_symbol.kind = LSP::SymbolKind::Variable; param_symbol.deprecated = false; param_symbol.local = true; param_symbol.range = range_of_node(param); @@ -398,10 +398,10 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p r_symbol.children.push_back(symbol); } break; case ClassNode::Member::ENUM_VALUE: { - lsp::DocumentSymbol symbol; + LSP::DocumentSymbol symbol; symbol.name = m.enum_value.identifier->name; - symbol.kind = lsp::SymbolKind::EnumMember; + symbol.kind = LSP::SymbolKind::EnumMember; symbol.deprecated = false; symbol.range.start = GodotPosition(m.enum_value.line, m.enum_value.leftmost_column).to_lsp(lines); symbol.range.end = GodotPosition(m.enum_value.line, m.enum_value.rightmost_column).to_lsp(lines); @@ -415,9 +415,9 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p r_symbol.children.push_back(symbol); } break; case ClassNode::Member::ENUM: { - lsp::DocumentSymbol symbol; + LSP::DocumentSymbol symbol; symbol.name = m.m_enum->identifier->name; - symbol.kind = lsp::SymbolKind::Enum; + symbol.kind = LSP::SymbolKind::Enum; symbol.range = range_of_node(m.m_enum); symbol.selectionRange = range_of_node(m.m_enum->identifier); symbol.documentation = m.m_enum->doc_data.description; @@ -434,10 +434,10 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p symbol.detail += "}"; for (GDScriptParser::EnumNode::Value value : m.m_enum->values) { - lsp::DocumentSymbol child; + LSP::DocumentSymbol child; child.name = value.identifier->name; - child.kind = lsp::SymbolKind::EnumMember; + child.kind = LSP::SymbolKind::EnumMember; child.deprecated = false; child.range.start = GodotPosition(value.line, value.leftmost_column).to_lsp(lines); child.range.end = GodotPosition(value.line, value.rightmost_column).to_lsp(lines); @@ -454,12 +454,12 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p r_symbol.children.push_back(symbol); } break; case ClassNode::Member::FUNCTION: { - lsp::DocumentSymbol symbol; + LSP::DocumentSymbol symbol; parse_function_symbol(m.function, symbol); r_symbol.children.push_back(symbol); } break; case ClassNode::Member::CLASS: { - lsp::DocumentSymbol symbol; + LSP::DocumentSymbol symbol; parse_class_symbol(m.m_class, symbol); r_symbol.children.push_back(symbol); } break; @@ -471,13 +471,13 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p } } -void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionNode *p_func, lsp::DocumentSymbol &r_symbol) { +void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionNode *p_func, LSP::DocumentSymbol &r_symbol) { const String uri = get_uri(); bool is_named = p_func->identifier != nullptr; r_symbol.name = is_named ? p_func->identifier->name : ""; - r_symbol.kind = (p_func->is_static || p_func->source_lambda != nullptr) ? lsp::SymbolKind::Function : lsp::SymbolKind::Method; + r_symbol.kind = (p_func->is_static || p_func->source_lambda != nullptr) ? LSP::SymbolKind::Function : LSP::SymbolKind::Method; r_symbol.detail = "func"; if (is_named) { r_symbol.detail += " " + String(p_func->identifier->name); @@ -570,9 +570,9 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN const GDScriptParser::SuiteNode *suite_node = N->get(); for (int i = 0; i < suite_node->locals.size(); i++) { const SuiteNode::Local &local = suite_node->locals[i]; - lsp::DocumentSymbol symbol; + LSP::DocumentSymbol symbol; symbol.name = local.name; - symbol.kind = local.type == SuiteNode::Local::CONSTANT ? lsp::SymbolKind::Constant : lsp::SymbolKind::Variable; + symbol.kind = local.type == SuiteNode::Local::CONSTANT ? LSP::SymbolKind::Constant : LSP::SymbolKind::Variable; switch (local.type) { case SuiteNode::Local::CONSTANT: symbol.range = range_of_node(local.constant); @@ -583,7 +583,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN symbol.selectionRange = range_of_node(local.variable->identifier); if (local.variable->initializer && local.variable->initializer->type == GDScriptParser::Node::LAMBDA) { GDScriptParser::LambdaNode *lambda_node = (GDScriptParser::LambdaNode *)local.variable->initializer; - lsp::DocumentSymbol lambda; + LSP::DocumentSymbol lambda; parse_function_symbol(lambda_node->function, lambda); // Merge lambda into current variable. // -> Only interested in new variables, not lambda itself. @@ -629,7 +629,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN } } -String ExtendGDScriptParser::get_text_for_completion(const lsp::Position &p_cursor) const { +String ExtendGDScriptParser::get_text_for_completion(const LSP::Position &p_cursor) const { String longthing; int len = lines.size(); for (int i = 0; i < len; i++) { @@ -649,7 +649,7 @@ String ExtendGDScriptParser::get_text_for_completion(const lsp::Position &p_curs return longthing; } -String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_cursor, const String &p_symbol, bool p_func_required) const { +String ExtendGDScriptParser::get_text_for_lookup_symbol(const LSP::Position &p_cursor, const String &p_symbol, bool p_func_required) const { String longthing; int len = lines.size(); for (int i = 0; i < len; i++) { @@ -687,7 +687,7 @@ String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_c return longthing; } -String ExtendGDScriptParser::get_identifier_under_position(const lsp::Position &p_position, lsp::Range &r_range) const { +String ExtendGDScriptParser::get_identifier_under_position(const LSP::Position &p_position, LSP::Range &r_range) const { ERR_FAIL_INDEX_V(p_position.line, lines.size(), ""); String line = lines[p_position.line]; if (line.is_empty()) { @@ -709,7 +709,7 @@ String ExtendGDScriptParser::get_identifier_under_position(const lsp::Position & // -> Move position to previous character if: // * Position not on valid identifier char. // * Prev position is valid identifier char. - lsp::Position pos = p_position; + LSP::Position pos = p_position; if ( pos.character >= line.length() // Cursor at end of line. || (!is_ascii_identifier_char(line[pos.character]) // Not on valid identifier char. @@ -753,8 +753,8 @@ String ExtendGDScriptParser::get_uri() const { return GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_uri(path); } -const lsp::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(int p_line, const lsp::DocumentSymbol &p_parent, const String &p_symbol_name) const { - const lsp::DocumentSymbol *ret = nullptr; +const LSP::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(int p_line, const LSP::DocumentSymbol &p_parent, const String &p_symbol_name) const { + const LSP::DocumentSymbol *ret = nullptr; if (p_line < p_parent.range.start.line) { return ret; } else if (p_parent.range.start.line == p_line && (p_symbol_name.is_empty() || p_parent.name == p_symbol_name)) { @@ -770,7 +770,7 @@ const lsp::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(i return ret; } -Error ExtendGDScriptParser::get_left_function_call(const lsp::Position &p_position, lsp::Position &r_func_pos, int &r_arg_index) const { +Error ExtendGDScriptParser::get_left_function_call(const LSP::Position &p_position, LSP::Position &r_func_pos, int &r_arg_index) const { ERR_FAIL_INDEX_V(p_position.line, lines.size(), ERR_INVALID_PARAMETER); int bracket_stack = 0; @@ -814,22 +814,22 @@ Error ExtendGDScriptParser::get_left_function_call(const lsp::Position &p_positi return ERR_METHOD_NOT_FOUND; } -const lsp::DocumentSymbol *ExtendGDScriptParser::get_symbol_defined_at_line(int p_line, const String &p_symbol_name) const { +const LSP::DocumentSymbol *ExtendGDScriptParser::get_symbol_defined_at_line(int p_line, const String &p_symbol_name) const { if (p_line <= 0) { return &class_symbol; } return search_symbol_defined_at_line(p_line, class_symbol, p_symbol_name); } -const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String &p_name, const String &p_subclass) const { +const LSP::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String &p_name, const String &p_subclass) const { if (p_subclass.is_empty()) { - const lsp::DocumentSymbol *const *ptr = members.getptr(p_name); + const LSP::DocumentSymbol *const *ptr = members.getptr(p_name); if (ptr) { return *ptr; } } else { if (const ClassMembers *_class = inner_classes.getptr(p_subclass)) { - const lsp::DocumentSymbol *const *ptr = _class->getptr(p_name); + const LSP::DocumentSymbol *const *ptr = _class->getptr(p_name); if (ptr) { return *ptr; } @@ -839,15 +839,15 @@ const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String return nullptr; } -const List &ExtendGDScriptParser::get_document_links() const { +const List &ExtendGDScriptParser::get_document_links() const { return document_links; } const Array &ExtendGDScriptParser::get_member_completions() { if (member_completions.is_empty()) { - for (const KeyValue &E : members) { - const lsp::DocumentSymbol *symbol = E.value; - lsp::CompletionItem item = symbol->make_completion_item(); + for (const KeyValue &E : members) { + const LSP::DocumentSymbol *symbol = E.value; + LSP::CompletionItem item = symbol->make_completion_item(); item.data = JOIN_SYMBOLS(path, E.key); member_completions.push_back(item.to_json()); } @@ -855,9 +855,9 @@ const Array &ExtendGDScriptParser::get_member_completions() { for (const KeyValue &E : inner_classes) { const ClassMembers *inner_class = &E.value; - for (const KeyValue &F : *inner_class) { - const lsp::DocumentSymbol *symbol = F.value; - lsp::CompletionItem item = symbol->make_completion_item(); + for (const KeyValue &F : *inner_class) { + const LSP::DocumentSymbol *symbol = F.value; + LSP::CompletionItem item = symbol->make_completion_item(); item.data = JOIN_SYMBOLS(path, JOIN_SYMBOLS(E.key, F.key)); member_completions.push_back(item.to_json()); } @@ -883,7 +883,7 @@ Dictionary ExtendGDScriptParser::dump_function_api(const GDScriptParser::Functio } parameters.push_back(arg); } - if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(p_func->start_line))) { + if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(p_func->start_line))) { func["signature"] = symbol->detail; func["description"] = symbol->documentation; } @@ -906,7 +906,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode class_api["extends_file"] = String(p_class->extends_path); class_api["icon"] = String(p_class->icon_path); - if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(p_class->start_line))) { + if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(p_class->start_line))) { class_api["signature"] = symbol->detail; class_api["description"] = symbol->documentation; } @@ -929,7 +929,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode api["name"] = m.constant->identifier->name; api["value"] = m.constant->initializer->reduced_value; api["data_type"] = m.constant->get_datatype().to_string(); - if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.constant->start_line))) { + if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.constant->start_line))) { api["signature"] = symbol->detail; api["description"] = symbol->documentation; } @@ -940,7 +940,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode api["name"] = m.enum_value.identifier->name; api["value"] = m.enum_value.value; api["data_type"] = m.get_datatype().to_string(); - if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.enum_value.line))) { + if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.enum_value.line))) { api["signature"] = symbol->detail; api["description"] = symbol->documentation; } @@ -956,7 +956,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode api["name"] = m.m_enum->identifier->name; api["value"] = enum_dict; api["data_type"] = m.get_datatype().to_string(); - if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.m_enum->start_line))) { + if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.m_enum->start_line))) { api["signature"] = symbol->detail; api["description"] = symbol->documentation; } @@ -970,7 +970,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode api["setter"] = m.variable->setter ? ("@" + String(m.variable->identifier->name) + "_setter") : (m.variable->setter_pointer != nullptr ? String(m.variable->setter_pointer->name) : String()); api["getter"] = m.variable->getter ? ("@" + String(m.variable->identifier->name) + "_getter") : (m.variable->getter_pointer != nullptr ? String(m.variable->getter_pointer->name) : String()); api["export"] = m.variable->exported; - if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.variable->start_line))) { + if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.variable->start_line))) { api["signature"] = symbol->detail; api["description"] = symbol->documentation; } @@ -984,7 +984,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode pars.append(String(m.signal->parameters[j]->identifier->name)); } api["arguments"] = pars; - if (const lsp::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.signal->start_line))) { + if (const LSP::DocumentSymbol *symbol = get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(m.signal->start_line))) { api["signature"] = symbol->detail; api["description"] = symbol->documentation; } diff --git a/modules/gdscript/language_server/gdscript_extend_parser.h b/modules/gdscript/language_server/gdscript_extend_parser.h index c3db2014f24..e7f6e41e1ce 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.h +++ b/modules/gdscript/language_server/gdscript_extend_parser.h @@ -50,12 +50,12 @@ #define JOIN_SYMBOLS(p_path, name) ((p_path) + SYMBOL_SEPARATOR + (name)) #endif -typedef HashMap ClassMembers; +typedef HashMap ClassMembers; /** - * Represents a Position as used by GDScript Parser. Used for conversion to and from `lsp::Position`. + * Represents a Position as used by GDScript Parser. Used for conversion to and from `LSP::Position`. * - * Difference to `lsp::Position`: + * Difference to `LSP::Position`: * * Line & Char/column: 1-based * * LSP: both 0-based * * Tabs are expanded to columns using tab size (`text_editor/behavior/indent/size`). @@ -79,8 +79,8 @@ struct GodotPosition { GodotPosition(int p_line, int p_column) : line(p_line), column(p_column) {} - lsp::Position to_lsp(const Vector &p_lines) const; - static GodotPosition from_lsp(const lsp::Position p_pos, const Vector &p_lines); + LSP::Position to_lsp(const Vector &p_lines) const; + static GodotPosition from_lsp(const LSP::Position p_pos, const Vector &p_lines); bool operator==(const GodotPosition &p_other) const { return line == p_other.line && column == p_other.column; @@ -98,8 +98,8 @@ struct GodotRange { GodotRange(GodotPosition p_start, GodotPosition p_end) : start(p_start), end(p_end) {} - lsp::Range to_lsp(const Vector &p_lines) const; - static GodotRange from_lsp(const lsp::Range &p_range, const Vector &p_lines); + LSP::Range to_lsp(const Vector &p_lines) const; + static GodotRange from_lsp(const LSP::Range &p_range, const Vector &p_lines); bool operator==(const GodotRange &p_other) const { return start == p_other.start && end == p_other.end; @@ -114,41 +114,41 @@ class ExtendGDScriptParser : public GDScriptParser { String path; Vector lines; - lsp::DocumentSymbol class_symbol; - Vector diagnostics; - List document_links; + LSP::DocumentSymbol class_symbol; + Vector diagnostics; + List document_links; ClassMembers members; HashMap inner_classes; - lsp::Range range_of_node(const GDScriptParser::Node *p_node) const; + LSP::Range range_of_node(const GDScriptParser::Node *p_node) const; void update_diagnostics(); void update_symbols(); void update_document_links(const String &p_code); - void parse_class_symbol(const GDScriptParser::ClassNode *p_class, lsp::DocumentSymbol &r_symbol); - void parse_function_symbol(const GDScriptParser::FunctionNode *p_func, lsp::DocumentSymbol &r_symbol); + void parse_class_symbol(const GDScriptParser::ClassNode *p_class, LSP::DocumentSymbol &r_symbol); + void parse_function_symbol(const GDScriptParser::FunctionNode *p_func, LSP::DocumentSymbol &r_symbol); Dictionary dump_function_api(const GDScriptParser::FunctionNode *p_func) const; Dictionary dump_class_api(const GDScriptParser::ClassNode *p_class) const; - const lsp::DocumentSymbol *search_symbol_defined_at_line(int p_line, const lsp::DocumentSymbol &p_parent, const String &p_symbol_name = "") const; + const LSP::DocumentSymbol *search_symbol_defined_at_line(int p_line, const LSP::DocumentSymbol &p_parent, const String &p_symbol_name = "") const; Array member_completions; public: _FORCE_INLINE_ const String &get_path() const { return path; } _FORCE_INLINE_ const Vector &get_lines() const { return lines; } - _FORCE_INLINE_ const lsp::DocumentSymbol &get_symbols() const { return class_symbol; } - _FORCE_INLINE_ const Vector &get_diagnostics() const { return diagnostics; } + _FORCE_INLINE_ const LSP::DocumentSymbol &get_symbols() const { return class_symbol; } + _FORCE_INLINE_ const Vector &get_diagnostics() const { return diagnostics; } _FORCE_INLINE_ const ClassMembers &get_members() const { return members; } _FORCE_INLINE_ const HashMap &get_inner_classes() const { return inner_classes; } - Error get_left_function_call(const lsp::Position &p_position, lsp::Position &r_func_pos, int &r_arg_index) const; + Error get_left_function_call(const LSP::Position &p_position, LSP::Position &r_func_pos, int &r_arg_index) const; - String get_text_for_completion(const lsp::Position &p_cursor) const; - String get_text_for_lookup_symbol(const lsp::Position &p_cursor, const String &p_symbol = "", bool p_func_required = false) const; - String get_identifier_under_position(const lsp::Position &p_position, lsp::Range &r_range) const; + String get_text_for_completion(const LSP::Position &p_cursor) const; + String get_text_for_lookup_symbol(const LSP::Position &p_cursor, const String &p_symbol = "", bool p_func_required = false) const; + String get_identifier_under_position(const LSP::Position &p_position, LSP::Range &r_range) const; String get_uri() const; /** @@ -159,9 +159,9 @@ public: * -> Without `p_symbol_name`: returns `handle_arg`. Even if parameter (`arg`) is wanted. * With `p_symbol_name`: symbol name MUST match `p_symbol_name`: returns `arg`. */ - const lsp::DocumentSymbol *get_symbol_defined_at_line(int p_line, const String &p_symbol_name = "") const; - const lsp::DocumentSymbol *get_member_symbol(const String &p_name, const String &p_subclass = "") const; - const List &get_document_links() const; + const LSP::DocumentSymbol *get_symbol_defined_at_line(int p_line, const String &p_symbol_name = "") const; + const LSP::DocumentSymbol *get_member_symbol(const String &p_name, const String &p_subclass = "") const; + const List &get_document_links() const; const Array &get_member_completions(); Dictionary generate_api() const; diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp index b636dbe580d..fb18e1538b1 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.cpp +++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp @@ -171,7 +171,7 @@ void GDScriptLanguageProtocol::_bind_methods() { } Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) { - lsp::InitializeResult ret; + LSP::InitializeResult ret; String root_uri = p_params["rootUri"]; String root = p_params["rootPath"]; @@ -213,11 +213,11 @@ Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) { } void GDScriptLanguageProtocol::initialized(const Variant &p_params) { - lsp::GodotCapabilities capabilities; + LSP::GodotCapabilities capabilities; DocTools *doc = EditorHelp::get_doc_data(); for (const KeyValue &E : doc->class_list) { - lsp::GodotNativeClassInfo gdclass; + LSP::GodotNativeClassInfo gdclass; gdclass.name = E.value.name; gdclass.class_doc = &(E.value); if (ClassDB::ClassInfo *ptr = ClassDB::classes.getptr(StringName(E.value.name))) { diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp index 72170777ee4..eb325deb6dd 100644 --- a/modules/gdscript/language_server/gdscript_text_document.cpp +++ b/modules/gdscript/language_server/gdscript_text_document.cpp @@ -63,7 +63,7 @@ void GDScriptTextDocument::_bind_methods() { } void GDScriptTextDocument::didOpen(const Variant &p_param) { - lsp::TextDocumentItem doc = load_document_item(p_param); + LSP::TextDocumentItem doc = load_document_item(p_param); sync_script_content(doc.uri, doc.text); } @@ -73,11 +73,11 @@ void GDScriptTextDocument::didClose(const Variant &p_param) { } void GDScriptTextDocument::didChange(const Variant &p_param) { - lsp::TextDocumentItem doc = load_document_item(p_param); + LSP::TextDocumentItem doc = load_document_item(p_param); Dictionary dict = p_param; Array contentChanges = dict["contentChanges"]; for (int i = 0; i < contentChanges.size(); ++i) { - lsp::TextDocumentContentChangeEvent evt; + LSP::TextDocumentContentChangeEvent evt; evt.load(contentChanges[i]); doc.text = evt.text; } @@ -85,7 +85,7 @@ void GDScriptTextDocument::didChange(const Variant &p_param) { } void GDScriptTextDocument::willSaveWaitUntil(const Variant &p_param) { - lsp::TextDocumentItem doc = load_document_item(p_param); + LSP::TextDocumentItem doc = load_document_item(p_param); String path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(doc.uri); Ref