From 19af0b326a0c790bcc9a9e30dc69bfeceeabc42c Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Sat, 23 Mar 2024 21:43:38 +0100 Subject: [PATCH] update --- analyzer/psi/doc_comment_extractor.v | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/analyzer/psi/doc_comment_extractor.v b/analyzer/psi/doc_comment_extractor.v index 0347e1cf..e42b015d 100644 --- a/analyzer/psi/doc_comment_extractor.v +++ b/analyzer/psi/doc_comment_extractor.v @@ -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() @@ -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 }