@@ -754,13 +754,17 @@ static String _make_arguments_hint(const MethodInfo &p_info, int p_arg_idx, bool
754754 return arghint;
755755}
756756
757- static String _make_arguments_hint (const GDScriptParser::FunctionNode *p_function, int p_arg_idx) {
757+ static String _make_arguments_hint (const GDScriptParser::FunctionNode *p_function, int p_arg_idx, bool p_just_args = false ) {
758758 String arghint;
759759
760- if (p_function-> get_datatype (). builtin_type == Variant::NIL ) {
761- arghint = " void " + p_function-> identifier -> name . operator String () + " (" ;
760+ if (p_just_args ) {
761+ arghint = " (" ;
762762 } else {
763- arghint = p_function->get_datatype ().to_string () + " " + p_function->identifier ->name .operator String () + " (" ;
763+ if (p_function->get_datatype ().builtin_type == Variant::NIL) {
764+ arghint = " void " + p_function->identifier ->name .operator String () + " (" ;
765+ } else {
766+ arghint = p_function->get_datatype ().to_string () + " " + p_function->identifier ->name .operator String () + " (" ;
767+ }
764768 }
765769
766770 for (int i = 0 ; i < p_function->parameters .size (); i++) {
@@ -2731,6 +2735,25 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
27312735 while (base_type.is_set () && !base_type.is_variant ()) {
27322736 switch (base_type.kind ) {
27332737 case GDScriptParser::DataType::CLASS: {
2738+ if (base_type.is_meta_type && p_method == SNAME (" new" )) {
2739+ const GDScriptParser::ClassNode *current = base_type.class_type ;
2740+
2741+ do {
2742+ if (current->has_member (" _init" )) {
2743+ const GDScriptParser::ClassNode::Member &member = current->get_member (" _init" );
2744+
2745+ if (member.type == GDScriptParser::ClassNode::Member::FUNCTION) {
2746+ r_arghint = base_type.class_type ->get_datatype ().to_string () + " new" + _make_arguments_hint (member.function , p_argidx, true );
2747+ return ;
2748+ }
2749+ }
2750+ current = current->base_type .class_type ;
2751+ } while (current != nullptr );
2752+
2753+ r_arghint = base_type.class_type ->get_datatype ().to_string () + " new()" ;
2754+ return ;
2755+ }
2756+
27342757 if (base_type.class_type ->has_member (p_method)) {
27352758 const GDScriptParser::ClassNode::Member &member = base_type.class_type ->get_member (p_method);
27362759
0 commit comments