@@ -286,7 +286,7 @@ function printmethod(buffer::IOBuffer, binding::Docs.Binding, func, method::Meth
286
286
local args = arguments (method)
287
287
local kws = keywords (func, method)
288
288
local where_syntax = []
289
-
289
+
290
290
# find inner tuple type
291
291
function f (t)
292
292
# t is always either a UnionAll which represents a generic type or a Tuple where each parameter is the argument
@@ -335,10 +335,10 @@ function printmethod(buffer::IOBuffer, binding::Docs.Binding, func, method::Meth
335
335
break signature up into a nicely formatted multiline method signature.
336
336
=#
337
337
nl_delim, nl = get_format_delimiters (
338
- args,
338
+ args,
339
339
kws;
340
- type_info = join ([string (get_type_at_i (typesig, i)) for i in eachindex (args)]),
341
- delim= " " ,
340
+ type_info = join ([string (get_type_at_i (typesig, i)) for i in eachindex (args)]),
341
+ delim= " " ,
342
342
break_point= 40
343
343
)
344
344
@@ -547,12 +547,12 @@ new line character. Otherwise, return an empty string, so that the formatting is
547
547
unaffected.
548
548
"""
549
549
function get_format_delimiters (args, kws; delim= " " , break_point= 40 , type_info = " " )
550
- estimated_line_width = length (join (string .(args))) +
550
+ estimated_line_width = length (join (string .(args))) +
551
551
length (join (string .(kws))) + length (type_info)
552
-
552
+
553
553
nl_delim = estimated_line_width > break_point ? " \n $delim " : " "
554
554
nl = estimated_line_width > break_point ? " \n " : " "
555
-
555
+
556
556
return nl_delim, nl
557
557
end
558
558
@@ -564,11 +564,11 @@ Format the return type to look prettier.
564
564
function format_return_type_string (rt; delim = " " , break_point= 40 )
565
565
if startswith (string (rt), " Tuple{" ) && length (string (rt)) > break_point
566
566
string (
567
- " Tuple{\n $delim " ,
567
+ " Tuple{\n $delim " ,
568
568
join ([string (x) for x in rt. types]," ,\n $delim " ),
569
569
" \n }" ,
570
570
)
571
571
else # TODO Unions{...} look ugly, but represent one type, so maybe should be on one line
572
572
string (rt)
573
573
end
574
- end
574
+ end
0 commit comments