diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2017-11-10 23:20:04 +0000 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2017-11-11 23:50:56 +0000 |
commit | b835aec87bcc29fa5a21873412fbccd0dd2f06ee (patch) | |
tree | 64452724c1bb2d9aa4b5fcf998a9243830a2d357 | |
parent | b3c08a83266b591cc8442946e94d71eab992ec49 (diff) |
Fixed help lookup not finding classes, issue 11867
-rw-r--r-- | modules/gdscript/gd_editor.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index de8e35c406..0db3694a49 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -2771,31 +2771,31 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } //global - for (Map<StringName, int>::Element *E = GDScriptLanguage::get_singleton()->get_global_map().front(); E; E = E->next()) { - if (E->key() == p_symbol) { - - Variant value = GDScriptLanguage::get_singleton()->get_global_array()[E->get()]; - if (value.get_type() == Variant::OBJECT) { - Object *obj = value; - if (obj) { - - if (Object::cast_to<GDNativeClass>(obj)) { - r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS; - r_result.class_name = Object::cast_to<GDNativeClass>(obj)->get_name(); - - } else { - r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS; - r_result.class_name = obj->get_class(); - } - return OK; + Map<StringName, int> classes = GDScriptLanguage::get_singleton()->get_global_map(); + if (classes.has(p_symbol)) { + Variant value = GDScriptLanguage::get_singleton()->get_global_array()[classes[p_symbol]]; + if (value.get_type() == Variant::OBJECT) { + Object *obj = value; + if (obj) { + if (Object::cast_to<GDNativeClass>(obj)) { + r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS; + r_result.class_name = Object::cast_to<GDNativeClass>(obj)->get_name(); + } else { + r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS; + r_result.class_name = obj->get_class(); } - } else { - r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; - r_result.class_name = "@Global Scope"; - r_result.class_member = p_symbol; + // proxy class remove the underscore. + if (r_result.class_name.begins_with("_")) { + r_result.class_name = r_result.class_name.right(1); + } return OK; } + } else { + r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; + r_result.class_name = "@Global Scope"; + r_result.class_member = p_symbol; + return OK; } } } |