Skip to content

Commit

Permalink
add comments for referenced parameters in function signatures, see Ty…
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Nicolle committed Jan 20, 2023
1 parent 0340ef4 commit 90a3670
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/lib/converter/plugins/CommentPlugin.ts
Expand Up @@ -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);
}
});

Expand Down Expand Up @@ -542,6 +543,21 @@ function moveNestedParamTags(comment: Comment, parameter: ParameterReflection) {
}
}
},
reference(){
comment.blockTags.filter(
(t) =>
t.tag === "@param" &&
t.name?.startsWith(`${parameter.name}.`)
).forEach(tag => {
const path = tag.name!.split(".");
path.shift();
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));
Expand Down

0 comments on commit 90a3670

Please sign in to comment.