Skip to content

Commit cf03ccb

Browse files
committed
docs(semantic): add docs for JSDocCommentPart (#11999)
1 parent fc0ec83 commit cf03ccb

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

crates/oxc_semantic/src/jsdoc/parser/jsdoc_parts.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
use oxc_span::Span;
22

3-
/// Used for `JSDoc.comment` and `JSDocTag.comment`
3+
/// Represents the raw text of a JSDoc tag *outside* the type expression (`{}`) and tag name (e.g., `@param`),
4+
/// such as the parameter name or trailing description.
5+
///
6+
/// This is used to capture parts of a JSDoc tag that aren't types but still carry semantic meaning,
7+
/// for example, the name `bar` or the description text in `@param {foo=} bar Some description`.
8+
///
9+
/// ```js
10+
/// /**
11+
/// * @param {foo=} bar Some description
12+
/// * ^^^^^^^^^^^^^^^^^^^^
13+
/// * This is the `JSDocCommentPart`
14+
/// */
15+
/// ```
16+
///
17+
/// Used to populate the `.comment` field on `JSDoc` and `JSDocTag` nodes.
418
#[derive(Debug, Clone, Copy)]
519
pub struct JSDocCommentPart<'a> {
20+
/// The raw string content, such as a parameter name or freeform description text.
621
raw: &'a str,
22+
23+
/// The span in the source text corresponding to this part.
724
pub span: Span,
825
}
26+
927
impl<'a> JSDocCommentPart<'a> {
1028
pub fn new(part_content: &'a str, span: Span) -> Self {
1129
Self { raw: part_content, span }

0 commit comments

Comments
 (0)