Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Mar 23, 2024
1 parent f6c6305 commit 19af0b3
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions analyzer/psi/doc_comment_extractor.v
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ pub fn extract_doc_comment(el PsiElement) string {
comment = line
}

if comments.len == 0 {
if el is FieldDeclaration {
if next := el.next_sibling() {
if next is Comment {
comment_start_line := next.node.start_point().row
if comment_start_line == el_start_line {
return next.get_text().trim_string_left('//').trim_space()
}
mut field_eol_comment := ''
if el is FieldDeclaration {
if next := el.next_sibling() {
if next is Comment {
comment_start_line := next.node.start_point().row
if comment_start_line == el_start_line {
field_eol_comment = '... ' + next.get_text().trim_string_left('//').trim_space()
}
}
}
return ''
}

if comments.len == 0 {
return if field_eol_comment != '' { field_eol_comment } else { '' }
}

comments.reverse_in_place()
Expand Down Expand Up @@ -98,5 +100,6 @@ pub fn extract_doc_comment(el PsiElement) string {
}
}

return res.str()
res_str := res.str() + if field_eol_comment != '' { '\n\n' + field_eol_comment } else { '' }
return res_str
}

0 comments on commit 19af0b3

Please sign in to comment.