summaryrefslogtreecommitdiffstats
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2023-06-24 13:03:28 -0500
committerThaddeus Crews <repiteo@outlook.com>2024-09-04 10:27:26 -0500
commit9853a691447cd4e279f48820067174d3833b0065 (patch)
tree7c774abf550b9ededc4df8fac066dbcaae393203 /editor/editor_help.cpp
parent906a4e9db91c2c6b17a0cb1cddf2a96f64114646 (diff)
downloadredot-engine-9853a691447cd4e279f48820067174d3833b0065.tar.gz
Implement typed dictionaries
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 9b0c05d910..c596319851 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -376,10 +376,10 @@ static void _add_type_to_rt(const String &p_type, const String &p_enum, bool p_i
}
p_rt->push_color(type_color);
- bool add_array = false;
+ bool add_typed_container = false;
if (can_ref) {
if (link_t.ends_with("[]")) {
- add_array = true;
+ add_typed_container = true;
link_t = link_t.trim_suffix("[]");
display_t = display_t.trim_suffix("[]");
@@ -387,6 +387,22 @@ static void _add_type_to_rt(const String &p_type, const String &p_enum, bool p_i
p_rt->add_text("Array");
p_rt->pop(); // meta
p_rt->add_text("[");
+ } else if (link_t.begins_with("Dictionary[")) {
+ add_typed_container = true;
+ link_t = link_t.trim_prefix("Dictionary[").trim_suffix("]");
+ display_t = display_t.trim_prefix("Dictionary[").trim_suffix("]");
+
+ p_rt->push_meta("#Dictionary", RichTextLabel::META_UNDERLINE_ON_HOVER); // class
+ p_rt->add_text("Dictionary");
+ p_rt->pop(); // meta
+ p_rt->add_text("[");
+ p_rt->push_meta("#" + link_t.get_slice(", ", 0), RichTextLabel::META_UNDERLINE_ON_HOVER); // class
+ p_rt->add_text(_contextualize_class_specifier(display_t.get_slice(", ", 0), p_class));
+ p_rt->pop(); // meta
+ p_rt->add_text(", ");
+
+ link_t = link_t.get_slice(", ", 1);
+ display_t = _contextualize_class_specifier(display_t.get_slice(", ", 1), p_class);
} else if (is_bitfield) {
p_rt->push_color(Color(type_color, 0.5));
p_rt->push_hint(TTR("This value is an integer composed as a bitmask of the following flags."));
@@ -405,7 +421,7 @@ static void _add_type_to_rt(const String &p_type, const String &p_enum, bool p_i
p_rt->add_text(display_t);
if (can_ref) {
p_rt->pop(); // meta
- if (add_array) {
+ if (add_typed_container) {
p_rt->add_text("]");
} else if (is_bitfield) {
p_rt->push_color(Color(type_color, 0.5));