File tree Expand file tree Collapse file tree
emmylua_code_analysis/src
emmylua_ls/src/handlers/hover/function Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -939,11 +939,17 @@ impl<'a> TypeHumanizer<'a> {
939939
940940 w. write_char ( '(' ) ?;
941941 let saved = self . level ;
942+ let is_vararg = signature. is_vararg ;
943+ let last_idx = signature. params . len ( ) ;
942944 self . level = self . child_level ( ) ;
943945 for ( i, param) in signature. get_type_params ( ) . iter ( ) . enumerate ( ) {
944946 if i > 0 {
945947 w. write_str ( ", " ) ?;
946948 }
949+ if i == last_idx - 1 && is_vararg {
950+ w. write_str ( "..." ) ?;
951+ }
952+
947953 w. write_str ( & param. 0 ) ?;
948954 if let Some ( ty) = & param. 1 {
949955 w. write_str ( ": " ) ?;
Original file line number Diff line number Diff line change @@ -173,6 +173,10 @@ fn check_call_expr(
173173 }
174174 // Check for redundant parameters
175175 else {
176+ if func. is_variadic ( ) {
177+ return Some ( ( ) ) ;
178+ }
179+
176180 let mut min_call_args_count = call_args_count;
177181 if last_arg_is_dots {
178182 min_call_args_count = min_call_args_count. saturating_sub ( 1 ) ;
Original file line number Diff line number Diff line change @@ -351,12 +351,18 @@ fn hover_doc_function_type(
351351 func_name. to_string ( )
352352 } ;
353353
354+ let is_vararg = func. is_variadic ( ) ;
355+ let last_idx = func. get_params ( ) . len ( ) . saturating_sub ( 1 ) ;
356+
354357 let params = func
355358 . get_params ( )
356359 . iter ( )
357360 . enumerate ( )
358361 . map ( |( index, param) | {
359- let name = param. 0 . clone ( ) ;
362+ let mut name = param. 0 . clone ( ) ;
363+ if is_vararg && index == last_idx && name != "..." {
364+ name = format ! ( "...{}" , name) ;
365+ }
360366 if index == 0 && is_method && !func. is_colon_define ( ) {
361367 "" . to_string ( )
362368 } else if let Some ( ty) = & param. 1 {
You can’t perform that action at this time.
0 commit comments