From fe3045ee6b73117733740c001b555f3d1417d5c9 Mon Sep 17 00:00:00 2001 From: Leo Nicolle Date: Fri, 20 Jan 2023 11:43:50 +0100 Subject: [PATCH] add comments for referenced parameters in function signatures, see #2147 --- src/lib/converter/plugins/CommentPlugin.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/converter/plugins/CommentPlugin.ts b/src/lib/converter/plugins/CommentPlugin.ts index 899611e1a..11bc53bc5 100644 --- a/src/lib/converter/plugins/CommentPlugin.ts +++ b/src/lib/converter/plugins/CommentPlugin.ts @@ -386,9 +386,10 @@ export class CommentPlugin extends ConverterComponent { ); if (tag) { - parameter.comment = new Comment( - Comment.cloneDisplayParts(tag.content) - ); + if(!parameter.comment){ + parameter.comment = new Comment(); + } + parameter.comment.summary = Comment.cloneDisplayParts(tag.content); } }); @@ -542,6 +543,18 @@ function moveNestedParamTags(comment: Comment, parameter: ParameterReflection) { } } }, + reference(){ + comment.blockTags.filter( + (t) => + t.tag === "@param" && + t.name?.startsWith(`${parameter.name}.`) + ).forEach(tag => { + if(!parameter.comment){ + parameter.comment = new Comment(); + } + parameter.comment.blockTags.push(tag); + }) + }, // #1876, also do this for unions/intersections. union(u) { u.types.forEach((t) => t.visit(visitor));