Skip to content

Handling multiple comments per symbol #60

Open
@Gerrit0

Description

@Gerrit0

TypeScript allows multiple comments to be attached to a symbol. Consider:

/** Comment one **/
enum A { a }
/** Comment two **/
enum A { b = 1 }

This presents a problem for documentation generators parsing the comments as they must either pick one of the comments, or take both comments and combine them. I believe tsdoc should either provide a function to merge comments, or should provide guidance on how to choose the comment to keep.

For reference, TypeDoc supports an @preferred tag which tells the generator which comment to use. If no @preferred tag is present, it will take the longest comment. VSCode (ts language service?) appears to simply concatenate any comment summaries and lists any @remarks blocks separately.

Related to the above, it might be worth standardizing what should happen if multiple comments are attached to a node, for example:

/** Comment one **/
/** Comment two **/
enum A { a }

In TypeDoc, only comment two would be used to document A. However, in VSCode, I again see that the summaries have been joined.

I understand this isn't directly related to the parsing of an actual comment, which is tsdoc's focus. However, it is a closely related issue which would benefit from a standard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    general discussionNot a bug or enhancement, just a discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions