diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 381edcba502..6255cfd86a5 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -1147,8 +1147,54 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const } } + //autoloads as singletons + List props; + Globals::get_singleton()->get_property_list(&props); + + for(List::Element *E=props.front();E;E=E->next()) { + + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slice("/",1); + if (name==String(p_identifier)) { + + String path = Globals::get_singleton()->get(s); + if (path.begins_with("*")) { + String script =path.substr(1,path.length()); + + if (!script.ends_with(".gd")) { + //not a script, try find the script anyway, + //may have some success + script=script.basename()+".gd"; + } + + if (FileAccess::exists(script)) { + + //print_line("is a script"); + Ref