diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 7c01e85ff77..9d8089f00ee 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2826,6 +2826,15 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path ScriptCodeCompletionOption option(Variant::get_type_name((Variant::Type)i), ScriptCodeCompletionOption::KIND_CLASS); options.insert(option.display, option); } + List props; + ProjectSettings::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; + } + options.insert(s.get_slice("/", 1)); + } } List native_classes; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 99bfdae7ec7..14d8a3f4a21 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -5245,6 +5245,31 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive return; } p = NULL; + } else { + List props; + ProjectSettings::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 == base) { + String singleton_path = ProjectSettings::get_singleton()->get(s); + if (singleton_path.begins_with("*")) { + singleton_path = singleton_path.right(1); + } + if (!singleton_path.begins_with("res://")) { + singleton_path = "res://" + singleton_path; + } + base_script = ResourceLoader::load(singleton_path); + if (!base_script.is_valid()) { + _set_error("Class '" + base + "' could not be fully loaded (script error or cyclic inheritance).", p_class->line); + return; + } + p = NULL; + } + } } while (p) { @@ -5589,9 +5614,49 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source, } name_part++; continue; - } else { - p = current_class; } + List props; + ProjectSettings::get_singleton()->get_property_list(&props); + String singleton_path; + 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 == id) { + singleton_path = ProjectSettings::get_singleton()->get(s); + if (singleton_path.begins_with("*")) { + singleton_path = singleton_path.right(1); + } + if (!singleton_path.begins_with("res://")) { + singleton_path = "res://" + singleton_path; + } + break; + } + } + if (!singleton_path.empty()) { + Ref