Compute annotation instead of NoTypeAnn in docs code

This commit is contained in:
Chadtech 2021-08-10 00:21:21 -04:00
parent 81bbf57d4c
commit d7b347bd1d
2 changed files with 5 additions and 4 deletions

View file

@ -165,13 +165,14 @@ fn generate_entry_doc<'a>(
(new_acc, Some(comments_or_new_lines))
}
Def::Annotation(loc_pattern, _loc_ann) => match loc_pattern.value {
Def::Annotation(loc_pattern, loc_ann) => match loc_pattern.value {
Pattern::Identifier(identifier) => {
// Check if the definition is exposed
if ident_ids.get_id(&identifier.into()).is_some() {
let name = identifier.to_string();
let doc_def = DocDef {
name: identifier.to_string(),
type_annotation: NoTypeAnn,
name,
type_annotation: type_to_docs(false, loc_ann.value),
type_vars: Vec::new(),
docs: before_comments_or_new_lines.and_then(comments_or_new_lines_to_docs),
};

View file

@ -624,7 +624,7 @@ fn should_be_multiline(type_ann: &TypeAnnotation) -> bool {
is_multiline
}
TypeAnnotation::Function { args, output } => {
let mut is_multiline = should_be_multiline(output) || args.len() > 1;
let mut is_multiline = should_be_multiline(output) || args.len() > 2;
for arg in args {
if is_multiline {