aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-09 13:16:39 +0000
committerGitHub <[email protected]>2020-12-09 13:16:39 +0000
commitef989880fff36f10b7e166647497779bacc1c47f (patch)
tree3fbf3b76697775ec50c286f9691fc736d7fb4886 /crates/syntax/src/ast
parent7bda4c722bc5bb81b0f5b0f4c9390e3c7b602d0f (diff)
parentda3b5e35a69fd71ba061169e2fe719e36dbc3ef4 (diff)
Merge #6771
6771: Properly attach inner attributes in Attrs::new r=matklad a=Veykril Properly attach inner and outer attributes to the things they actually belong to in the HIR. ~~I can add some tests for this if wanted once I know where to put them/how to test for this.~~ Put some tests into `hover.rs`. So the following snippet ```rust mod foo { //! Hello } ``` now shows `Hello` on hover 🎉 Fixes #2148 Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r--crates/syntax/src/ast/token_ext.rs8
1 files changed, 8 insertions, 0 deletions
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 {
17 CommentKind::from_text(self.text()) 17 CommentKind::from_text(self.text())
18 } 18 }
19 19
20 pub fn is_inner(&self) -> bool {
21 self.kind().doc == Some(CommentPlacement::Inner)
22 }
23
24 pub fn is_outer(&self) -> bool {
25 self.kind().doc == Some(CommentPlacement::Outer)
26 }
27
20 pub fn prefix(&self) -> &'static str { 28 pub fn prefix(&self) -> &'static str {
21 let &(prefix, _kind) = CommentKind::BY_PREFIX 29 let &(prefix, _kind) = CommentKind::BY_PREFIX
22 .iter() 30 .iter()