aboutsummaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_editor.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2016-09-11 12:20:28 -0300
committerRémi Verschelde2016-09-18 23:19:04 +0200
commita72945f4e35fa726ccc6d2f3c99e9888b843a49e (patch)
tree0e4f4b21f67f319403570b5032336a34ba75f669 /modules/gdscript/gd_editor.cpp
parent3ff8dea5f9aff03a20f90c9ea95034c42ea51a10 (diff)
downloadgodot-a72945f4e35fa726ccc6d2f3c99e9888b843a49e.tar.gz
godot-a72945f4e35fa726ccc6d2f3c99e9888b843a49e.tar.zst
godot-a72945f4e35fa726ccc6d2f3c99e9888b843a49e.zip
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 b83350f4b2e968baac4d1551a6f21fe2e6b468ad)
Diffstat (limited to 'modules/gdscript/gd_editor.cpp')
-rw-r--r--modules/gdscript/gd_editor.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index 63c351cbf..9bed50933 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -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;