Skip to content

Commit

Permalink
feat: add inline struct field comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Mar 23, 2024
1 parent 78dafd7 commit c6cd5de
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions analyzer/psi/doc_comment_extractor.v
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ pub fn extract_doc_comment(el PsiElement) string {
}
}

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

comments.reverse_in_place()

lines := comments.map(it.get_text()
Expand Down

0 comments on commit c6cd5de

Please sign in to comment.