Skip to content

Commit fe3045e

Browse files
committed
add comments for referenced parameters in function signatures, see TypeStrong#2147
1 parent 0340ef4 commit fe3045e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/lib/converter/plugins/CommentPlugin.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,10 @@ export class CommentPlugin extends ConverterComponent {
386386
);
387387

388388
if (tag) {
389-
parameter.comment = new Comment(
390-
Comment.cloneDisplayParts(tag.content)
391-
);
389+
if(!parameter.comment){
390+
parameter.comment = new Comment();
391+
}
392+
parameter.comment.summary = Comment.cloneDisplayParts(tag.content);
392393
}
393394
});
394395

@@ -542,6 +543,18 @@ function moveNestedParamTags(comment: Comment, parameter: ParameterReflection) {
542543
}
543544
}
544545
},
546+
reference(){
547+
comment.blockTags.filter(
548+
(t) =>
549+
t.tag === "@param" &&
550+
t.name?.startsWith(`${parameter.name}.`)
551+
).forEach(tag => {
552+
if(!parameter.comment){
553+
parameter.comment = new Comment();
554+
}
555+
parameter.comment.blockTags.push(tag);
556+
})
557+
},
545558
// #1876, also do this for unions/intersections.
546559
union(u) {
547560
u.types.forEach((t) => t.visit(visitor));

0 commit comments

Comments
 (0)