Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/token_ext.rs')
-rw-r--r--crates/syntax/src/ast/token_ext.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/syntax/src/ast/token_ext.rs b/crates/syntax/src/ast/token_ext.rs
index e1a9f3ac03..83ab87c1c6 100644
--- a/crates/syntax/src/ast/token_ext.rs
+++ b/crates/syntax/src/ast/token_ext.rs
@@ -40,8 +40,8 @@ impl ast::Comment {
}
/// Returns the textual content of a doc comment node as a single string with prefix and suffix
- /// removed.
- pub fn doc_comment(&self) -> Option<&str> {
+ /// removed, plus the offset of the returned string from the beginning of the comment.
+ pub fn doc_comment(&self) -> Option<(&str, TextSize)> {
let kind = self.kind();
match kind {
CommentKind { shape, doc: Some(_) } => {
@@ -52,7 +52,7 @@ impl ast::Comment {
} else {
text
};
- Some(text)
+ Some((text, TextSize::of(prefix)))
}
_ => None,
}