Improve rendering of type-signatures in docs
- [x] Display function arguments using a newline-multiline strategy
when the signature gets too long. For example:
```
union_with
( left left: AssocList<key, value>
, right right: AssocList<key, value>
, with with: fn(key, value, value) -> value
) -> AssocList<key, value>
```
- [x] Show type-aliases as type-aliases in signatures; provided
they've been specified as type annotations. Otherwise, fallback to
the inferred type.
- [x] Do not show argument names in signatures, but show labels when
they're present. This reflects more the original intent behind
labels (which are meant as public-facing documentation).
This commit is contained in:
@@ -410,6 +410,7 @@ impl DocFunction {
|
||||
.docs_fn_signature(
|
||||
&func_def.name,
|
||||
&func_def.arguments,
|
||||
&func_def.return_annotation,
|
||||
func_def.return_type.clone(),
|
||||
)
|
||||
.to_pretty_string(MAX_COLUMNS),
|
||||
|
||||
Reference in New Issue
Block a user