1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Add a map of autoloads to ProjectSettings

So places that need to look into it can use the list instead of parsing
ProjectSettings details (like checking "*" in path for testing if it's
singleton).
This commit is contained in:
George Marques
2020-06-17 20:45:08 -03:00
parent a535b9160d
commit 9654365547
6 changed files with 93 additions and 60 deletions

View File

@@ -123,16 +123,11 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
case CompletionKind::NODE_PATHS: {
{
// AutoLoads
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
Map<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list();
for (List<PropertyInfo>::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);
suggestions.push_back(quoted("/root/" + name));
for (Map<StringName, ProjectSettings::AutoloadInfo>::Element *E = autoloads.front(); E; E = E->next()) {
const ProjectSettings::AutoloadInfo &info = E->value();
suggestions.push_back(quoted("/root/" + String(info.name)));
}
}