Merge pull request #86758 from Mickeon/autocompletion-project-settings

Add autocompletion for ProjectSettings' methods
This commit is contained in:
Rémi Verschelde 2024-03-01 17:21:59 +01:00
commit 0394328a71
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 24 additions and 0 deletions

View File

@ -1318,6 +1318,26 @@ const HashMap<StringName, HashSet<StringName>> &ProjectSettings::get_scene_group
return scene_groups_cache; return scene_groups_cache;
} }
#ifdef TOOLS_ENABLED
void ProjectSettings::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
const String pf = p_function;
if (p_idx == 0) {
if (pf == "has_setting" || pf == "set_setting" || pf == "get_setting" || pf == "get_setting_with_override" ||
pf == "set_order" || pf == "get_order" || pf == "set_initial_value" || pf == "set_as_basic" ||
pf == "set_as_internal" || pf == "set_restart_if_changed" || pf == "clear") {
for (const KeyValue<StringName, VariantContainer> &E : props) {
if (E.value.hide_from_editor) {
continue;
}
r_options->push_back(String(E.key).quote());
}
}
}
Object::get_argument_options(p_function, p_idx, r_options);
}
#endif
void ProjectSettings::_bind_methods() { void ProjectSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_setting", "name"), &ProjectSettings::has_setting); ClassDB::bind_method(D_METHOD("has_setting", "name"), &ProjectSettings::has_setting);
ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &ProjectSettings::set_setting); ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &ProjectSettings::set_setting);

View File

@ -222,6 +222,10 @@ public:
String get_scene_groups_cache_path() const; String get_scene_groups_cache_path() const;
void load_scene_groups_cache(); void load_scene_groups_cache();
#ifdef TOOLS_ENABLED
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
#endif
ProjectSettings(); ProjectSettings();
~ProjectSettings(); ~ProjectSettings();
}; };