Added constants from types in code completion, somehow this was never added.

Stuff like Label.ALIGN_CENTER or Mesh.PRIMITIVE_TRIANGLES did not complete..

(cherry picked from commit b83350f4b2)
This commit is contained in:
Juan Linietsky 2016-09-11 12:20:28 -03:00 committed by Rémi Verschelde
parent 3ff8dea5f9
commit a72945f4e3
1 changed files with 12 additions and 1 deletions

View File

@ -2112,7 +2112,18 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
GDCompletionIdentifier t;
if (_guess_expression_type(context,static_cast<const GDParser::OperatorNode *>(node)->arguments[0],p.get_completion_line(),t)) {
if (t.type==Variant::OBJECT && t.obj_type!=StringName()) {
if (t.type==Variant::OBJECT && t.obj_type=="GDNativeClass") {
//native enum
Ref<GDNativeClass> gdn = t.value;
if (gdn.is_valid()) {
StringName cn = gdn->get_name();
List<String> cnames;
ObjectTypeDB::get_integer_constant_list(cn,&cnames);
for (List<String>::Element *E=cnames.front();E;E=E->next()) {
options.insert(E->get());
}
}
} else if (t.type==Variant::OBJECT && t.obj_type!=StringName()) {
Ref<GDScript> on_script;