@@ -159,7 +159,7 @@ function format(::ModuleExports, buf, doc)
159159 if ! isempty (exports)
160160 println (buf)
161161 # Sorting ignores the `@` in macro names and sorts them in with others.
162- for sym in sort (exports, by = s -> lstrip (string (s), ' @' ))
162+ for sym in sort (exports, by= s -> lstrip (string (s), ' @' ))
163163 # Skip the module itself, since that's always exported.
164164 sym === nameof (object) && continue
165165 # We print linked names using Documenter.jl cross-reference syntax
@@ -206,7 +206,7 @@ function format(::ModuleImports, buf, doc)
206206 local imports = unique (ccall (:jl_module_usings , Any, (Any,), object))
207207 if ! isempty (imports)
208208 println (buf)
209- for mod in sort (imports, by = string)
209+ for mod in sort (imports, by= string)
210210 println (buf, " - `" , mod, " `" )
211211 end
212212 println (buf)
@@ -255,7 +255,7 @@ function format(::MethodList, buf, doc)
255255 local typesig = doc. data[:typesig ]
256256 local modname = doc. data[:module ]
257257 local func = Docs. resolve (binding)
258- local groups = methodgroups (func, typesig, modname; exact = false )
258+ local groups = methodgroups (func, typesig, modname; exact= false )
259259 if ! isempty (groups)
260260 println (buf)
261261 for group in groups
@@ -336,11 +336,13 @@ end
336336#
337337
338338"""
339- The singleton type for [`TYPEDSIGNATURES`](@ref) abbreviations.
339+ The type for [`TYPEDSIGNATURES`](@ref) abbreviations.
340340
341341$(:FIELDS )
342342"""
343- struct TypedMethodSignatures <: Abbreviation end
343+ struct TypedMethodSignatures <: Abbreviation
344+ return_types:: Bool
345+ end
344346
345347"""
346348An [`Abbreviation`](@ref) for including a simplified representation of all the method
@@ -358,9 +360,17 @@ f(x::Int, y::Int; a, b...)
358360```
359361````
360362"""
361- const TYPEDSIGNATURES = TypedMethodSignatures ()
363+ const TYPEDSIGNATURES = TypedMethodSignatures (true )
364+
365+ """
366+ An alternative to [`TYPEDSIGNATURES`](@ref) that omits the return type.
367+
368+ The return type shown by [`TYPEDSIGNATURES`](@ref) is often `-> Any`, which is usually not
369+ correct. It is nicer to then just omit the type completely.
370+ """
371+ const TYPEDSIGNATURESNORETURN = TypedMethodSignatures (false )
362372
363- function format (:: TypedMethodSignatures , buf, doc)
373+ function format (tms :: TypedMethodSignatures , buf, doc)
364374 local binding = doc. data[:binding ]
365375 local typesig = doc. data[:typesig ]
366376 local modname = doc. data[:module ]
@@ -395,7 +405,8 @@ function format(::TypedMethodSignatures, buf, doc)
395405 else
396406 t = tuples[findfirst (f, tuples)]
397407 end
398- printmethod (buf, binding, func, method, t)
408+ printmethod (buf, binding, func, method, t;
409+ print_return_types= tms. return_types)
399410 println (buf)
400411 end
401412 println (buf, " \n ```\n " )
@@ -574,7 +585,7 @@ An [`Abbreviation`](@ref) for including the package LICENSE.md.
574585"""
575586const LICENSE = License ()
576587
577- function format (:: T , buf, doc) where T <: Union{Readme,License}
588+ function format (:: T , buf, doc) where T<: Union{Readme,License}
578589 m = get (doc. data, :module , nothing )
579590 m === nothing && return
580591 path = pathof (m)
647658function included_range (abbr:: Template , parts:: Vector )
648659 # Select the correct indexing depending on what we find.
649660 build_range (:: Template , :: Nothing ) = 0 : - 1
650- build_range (:: Template{:before} , index) = 1 : (index - 1 )
651- build_range (:: Template{:after} , index) = (index + 1 ): lastindex (parts)
661+ build_range (:: Template{:before} , index) = 1 : (index- 1 )
662+ build_range (:: Template{:after} , index) = (index+ 1 ): lastindex (parts)
652663 # Search for index from either the front or back.
653664 find_index (:: Template{:before} ) = findfirst (is_docstr_template, parts)
654665 find_index (:: Template{:after} ) = findlast (is_docstr_template, parts)
@@ -662,13 +673,13 @@ function template_key(doc::Docs.DocStr)
662673 objname (obj:: Union{Function,Module,DataType,UnionAll,Core.IntrinsicFunction} , b:: Docs.Binding ) = nameof (obj)
663674 objname (obj, b:: Docs.Binding ) = Symbol (" " ) # Empty to force resolving to `:CONSTANTS` below.
664675 # Select the key returned based on input argument types.
665- _key (:: Module , sig, binding) = :MODULES
676+ _key (:: Module , sig, binding) = :MODULES
666677 _key (:: Function , :: typeof (Union{}), binding) = ismacro (binding) ? :MACROS : :FUNCTIONS
667- _key (:: Function , sig, binding) = ismacro (binding) ? :MACROS : :METHODS
678+ _key (:: Function , sig, binding) = ismacro (binding) ? :MACROS : :METHODS
668679 _key (:: DataType , :: typeof (Union{}), binding) = :TYPES
669680 _key (:: UnionAll , :: typeof (Union{}), binding) = :TYPES
670- _key (:: DataType , sig, binding) = :METHODS
671- _key (other, sig, binding) = :DEFAULT
681+ _key (:: DataType , sig, binding) = :METHODS
682+ _key (other, sig, binding) = :DEFAULT
672683
673684 binding = doc. data[:binding ]
674685 obj = Docs. resolve (binding)
0 commit comments