Skip to content

Commit 2aa9f62

Browse files
committed
fix comment spans in data defs
1 parent 787dc8a commit 2aa9f62

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

parser/src/parse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,7 @@ impl Parser<'_> {
17451745
let s = span.as_str(self.inputs, |s| s.trim_start_matches("#").trim().into());
17461746
lines.push(span.sp(s));
17471747
} else if let Some(sem) = self.next_token_map(Token::as_semantic_comment) {
1748+
lines.push(sem.span.clone().sp(sem.value.to_string().into()));
17481749
semantic.insert(sem.value, sem.span);
17491750
} else {
17501751
break;

src/lsp.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ impl Spanner {
377377
spans.push(prev.end_to(&curr).sp(SpanKind::Whitespace))
378378
}
379379
}
380+
if let Some(comments) = &field.comments {
381+
for line in &comments.lines {
382+
spans.push(line.span.clone().sp(SpanKind::Comment));
383+
}
384+
}
380385
spans.push(field.name.span.clone().sp(SpanKind::Ident {
381386
docs: self.binding_docs(&field.name.span),
382387
original: true,

0 commit comments

Comments
 (0)