diff options
author | Danil Alexeev <danil@alexeev.xyz> | 2020-01-16 15:31:10 +0300 |
---|---|---|
committer | Danil Alexeev <danil@alexeev.xyz> | 2020-01-16 15:41:02 +0300 |
commit | 45b510b332c01b254cd28dccca2950831d04da3f (patch) | |
tree | 7c4bc213466579dd7289b66edd654ad719cb2ede | |
parent | cd8cafc385dce506e06d958a91f8b5957effdc48 (diff) |
Fix function arguments hint format in GDScript editor
for consistency with the format of the documentation:
"type func_name(arg1: type, arg2: type)"
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index e2f2b7fc3b..18dfa49b97 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -555,7 +555,7 @@ static String _get_visual_datatype(const PropertyInfo &p_info, bool p_isarg = tr } if (p_info.type == Variant::NIL) { if (p_isarg || (p_info.usage & PROPERTY_USAGE_NIL_IS_VARIANT)) { - return "var"; + return "Variant"; } else { return "void"; } @@ -1736,14 +1736,12 @@ static String _make_arguments_hint(const MethodInfo &p_info, int p_arg_idx) { for (const List<PropertyInfo>::Element *E = p_info.arguments.front(); E; E = E->next()) { if (i > 0) { arghint += ", "; - } else { - arghint += " "; } if (i == p_arg_idx) { arghint += String::chr(0xFFFF); } - arghint += _get_visual_datatype(E->get(), true) + " " + E->get().name; + arghint += E->get().name + ": " + _get_visual_datatype(E->get(), true); if (i - def_args >= 0) { arghint += String(" = ") + p_info.default_arguments[i - def_args].get_construct_string(); @@ -1759,8 +1757,6 @@ static String _make_arguments_hint(const MethodInfo &p_info, int p_arg_idx) { if (p_info.flags & METHOD_FLAG_VARARG) { if (p_info.arguments.size() > 0) { arghint += ", "; - } else { - arghint += " "; } if (p_arg_idx >= p_info.arguments.size()) { arghint += String::chr(0xFFFF); @@ -1770,9 +1766,6 @@ static String _make_arguments_hint(const MethodInfo &p_info, int p_arg_idx) { arghint += String::chr(0xFFFF); } } - if (p_info.arguments.size() > 0 || (p_info.flags & METHOD_FLAG_VARARG)) { - arghint += " "; - } arghint += ")"; @@ -1787,14 +1780,12 @@ static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_functio for (int i = 0; i < p_function->arguments.size(); i++) { if (i > 0) { arghint += ", "; - } else { - arghint += " "; } if (i == p_arg_idx) { arghint += String::chr(0xFFFF); } - arghint += p_function->argument_types[i].to_string() + " " + p_function->arguments[i].operator String(); + arghint += p_function->arguments[i].operator String() + ": " + p_function->argument_types[i].to_string(); if (i - def_args >= 0) { String def_val = "<unknown>"; @@ -1818,9 +1809,6 @@ static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_functio } } - if (p_function->arguments.size() > 0) { - arghint += " "; - } arghint += ")"; return arghint; |