diff options
author | Micky <micheledevita2@gmail.com> | 2024-01-03 20:27:08 +0100 |
---|---|---|
committer | Micky <micheledevita2@gmail.com> | 2024-02-29 20:50:22 +0100 |
commit | 404b2bf9c218dc05a1716ba8d376dec932487ddc (patch) | |
tree | fcd3273457245e07a14b952e7c031fa475077e71 | |
parent | fbaab3cf537a892295aabdfd02c8052e370e6669 (diff) | |
download | redot-engine-404b2bf9c218dc05a1716ba8d376dec932487ddc.tar.gz |
Add autocompletion for ProjectSettings' methods
-rw-r--r-- | core/config/project_settings.cpp | 20 | ||||
-rw-r--r-- | core/config/project_settings.h | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 90e2e27320..2d9e0d9354 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1318,6 +1318,26 @@ const HashMap<StringName, HashSet<StringName>> &ProjectSettings::get_scene_group 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() { ClassDB::bind_method(D_METHOD("has_setting", "name"), &ProjectSettings::has_setting); ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &ProjectSettings::set_setting); diff --git a/core/config/project_settings.h b/core/config/project_settings.h index 55d5957ad1..10ddf43c3e 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -222,6 +222,10 @@ public: String get_scene_groups_cache_path() const; 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(); }; |