diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-08 22:50:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-08 22:50:35 +0200 |
commit | 682dbe5d00aa7730659771b16704eba83f166a7b (patch) | |
tree | 8555e07c3bfb3b2892d530bc93fbf47d14519e35 /editor | |
parent | d9d5990c517b63f41881de05cb4644c36e0c77e0 (diff) | |
parent | c5d7115038de5f83cb83e08748615a84fc26bee2 (diff) |
Merge pull request #64008 from YuriSizov/doctool-add-param-reference-syntax
Diffstat (limited to 'editor')
-rw-r--r-- | editor/doc_tools.cpp | 6 | ||||
-rw-r--r-- | editor/editor_help.cpp | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 46a2a0719a..864871bb7e 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -1019,7 +1019,7 @@ static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> & } else if (name == "returns_error") { ERR_FAIL_COND_V(!parser->has_attribute("number"), ERR_FILE_CORRUPT); method.errors_returned.push_back(parser->get_attribute_value("number").to_int()); - } else if (name == "argument") { + } else if (name == "param") { DocData::ArgumentDoc argument; ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT); argument.name = parser->get_attribute_value("name"); @@ -1350,9 +1350,9 @@ static void _write_method_doc(Ref<FileAccess> f, const String &p_name, Vector<Do } if (!a.default_value.is_empty()) { - _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\" />"); + _write_string(f, 3, "<param index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\" />"); } else { - _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " />"); + _write_string(f, 3, "<param index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " />"); } } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 5c3038c468..8d58469684 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1803,6 +1803,21 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { p_rt->pop(); pos = brk_end + 1; + } else if (tag.begins_with("param ")) { + const int tag_end = tag.find(" "); + const String param_name = tag.substr(tag_end + 1, tag.length()).lstrip(" "); + + // Use monospace font with translucent background color to make code easier to distinguish from other text. + p_rt->push_font(doc_code_font); + p_rt->push_bgcolor(Color(0.5, 0.5, 0.5, 0.15)); + p_rt->push_color(code_color); + p_rt->add_text(param_name); + p_rt->pop(); + p_rt->pop(); + p_rt->pop(); + + pos = brk_end + 1; + } else if (doc->class_list.has(tag)) { // Class reference tag such as [Node2D] or [SceneTree]. // Use monospace font with translucent colored background color to make clickable references |