From f8823e8cbcd4364db4155f5e20989c02b68cf855 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 8 Dec 2020 23:30:51 +0100 Subject: Properly fetch inner and outer docs on hir-level --- crates/syntax/src/ast/token_ext.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'crates/syntax') diff --git a/crates/syntax/src/ast/token_ext.rs b/crates/syntax/src/ast/token_ext.rs index a10b14778..52b7285dd 100644 --- a/crates/syntax/src/ast/token_ext.rs +++ b/crates/syntax/src/ast/token_ext.rs @@ -17,6 +17,14 @@ impl ast::Comment { CommentKind::from_text(self.text()) } + pub fn is_inner(&self) -> bool { + self.kind().doc == Some(CommentPlacement::Inner) + } + + pub fn is_outer(&self) -> bool { + self.kind().doc == Some(CommentPlacement::Outer) + } + pub fn prefix(&self) -> &'static str { let &(prefix, _kind) = CommentKind::BY_PREFIX .iter() -- cgit v1.2.3