Skip to content

Commit 0c86a0b

Browse files
committed
ParsedComment: Keep @usecase sections
ParsedComment used to work with the `expandedBody` of comments. The `expandedBody` is the body of the comment after expansion, and without the `@usecase` and `@define` tags. Because we want to show these, we use `expanded` which keeps these tags.
1 parent 96167e6 commit 0c86a0b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

compiler/src/dotty/tools/dotc/util/ParsedComment.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ class ParsedComment(val comment: Comment) {
2323
*/
2424
private type Bounds = (Int, Int)
2525

26-
/** The content of this comment, after expansion if possible. */
27-
val content: String = comment.expandedBody.getOrElse(comment.raw)
26+
/**
27+
* The content of this comment, after expansion if possible.
28+
*
29+
* Note that we use `expanded` instead of `expandedBody` to show `@usecase` and `@define`
30+
* sections.
31+
*/
32+
val content: String = comment.expanded.getOrElse(comment.raw)
2833

2934
/** An index that marks all sections boundaries */
3035
private lazy val tagIndex: List[Bounds] = CommentParsing.tagIndex(content)

0 commit comments

Comments
 (0)