@@ -38,6 +38,11 @@ pub fn parse_jsdoc(
3838 // This includes inline code blocks or markdown-style code inside comments.
3939 let mut in_backticks = false ;
4040
41+ // Track whether we're currently inside quotes '...' or "..."
42+ // This includes package names when doing a @import
43+ let mut in_double_quotes = false ;
44+ let mut in_single_quotes = false ;
45+
4146 // This flag tells us if we have already found the main comment block.
4247 // The first part before any @tags is considered the comment. Everything after is a tag.
4348 let mut comment_found = false ;
@@ -52,8 +57,12 @@ pub fn parse_jsdoc(
5257 while let Some ( ch) = chars. next ( ) {
5358 // A `@` is only considered the start of a tag if we are not nested inside
5459 // braces, square brackets, or backtick-quoted sections
55- let can_parse =
56- curly_brace_depth == 0 && square_brace_depth == 0 && brace_depth == 0 && !in_backticks;
60+ let can_parse = curly_brace_depth == 0
61+ && square_brace_depth == 0
62+ && brace_depth == 0
63+ && !in_backticks
64+ && !in_double_quotes
65+ && !in_single_quotes;
5766
5867 match ch {
5968 // NOTE: For now, only odd backtick(s) are handled.
@@ -67,6 +76,8 @@ pub fn parse_jsdoc(
6776 in_backticks = !in_backticks;
6877 }
6978 }
79+ '"' => in_double_quotes = !in_double_quotes,
80+ '\'' => in_single_quotes = !in_single_quotes,
7081 '{' => curly_brace_depth += 1 ,
7182 '}' => curly_brace_depth = curly_brace_depth. saturating_sub ( 1 ) ,
7283 '(' => brace_depth += 1 ,
0 commit comments