diff --git a/analyzer/psi/doc_comment_extractor.v b/analyzer/psi/doc_comment_extractor.v index 55b285de..72cc70ea 100644 --- a/analyzer/psi/doc_comment_extractor.v +++ b/analyzer/psi/doc_comment_extractor.v @@ -26,6 +26,22 @@ pub fn extract_doc_comment(el PsiElement) string { comment = line } + 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() + } + } + } + } + + if comments.len == 0 { + return if field_eol_comment != '' { '... ' + field_eol_comment } else { '' } + } + comments.reverse_in_place() lines := comments.map(it.get_text() @@ -84,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 }