diff options
Diffstat (limited to 'crates/ra_editor/src')
| -rw-r--r-- | crates/ra_editor/src/symbols.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_editor/src/symbols.rs b/crates/ra_editor/src/symbols.rs index bf3ac6ff2..f7681c76f 100644 --- a/crates/ra_editor/src/symbols.rs +++ b/crates/ra_editor/src/symbols.rs | |||
| @@ -24,12 +24,17 @@ pub struct FileSymbol { | |||
| 24 | 24 | ||
| 25 | impl FileSymbol { | 25 | impl FileSymbol { |
| 26 | pub fn docs(&self, file: &File) -> Option<String> { | 26 | pub fn docs(&self, file: &File) -> Option<String> { |
| 27 | file.syntax().descendants() | 27 | file.syntax() |
| 28 | .descendants() | ||
| 28 | .filter(|node| node.kind() == self.kind && node.range() == self.node_range) | 29 | .filter(|node| node.kind() == self.kind && node.range() == self.node_range) |
| 29 | .filter_map(|node: SyntaxNodeRef| { | 30 | .filter_map(|node: SyntaxNodeRef| { |
| 30 | fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> { | 31 | fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> { |
| 31 | let comments = node.doc_comment_text(); | 32 | let comments = node.doc_comment_text(); |
| 32 | if comments.is_empty() { None } else { Some(comments) } | 33 | if comments.is_empty() { |
| 34 | None | ||
| 35 | } else { | ||
| 36 | Some(comments) | ||
| 37 | } | ||
| 33 | } | 38 | } |
| 34 | 39 | ||
| 35 | visitor() | 40 | visitor() |
| @@ -42,7 +47,8 @@ impl FileSymbol { | |||
| 42 | .visit(doc_comments::<ast::ConstDef>) | 47 | .visit(doc_comments::<ast::ConstDef>) |
| 43 | .visit(doc_comments::<ast::StaticDef>) | 48 | .visit(doc_comments::<ast::StaticDef>) |
| 44 | .accept(node)? | 49 | .accept(node)? |
| 45 | }).nth(0) | 50 | }) |
| 51 | .nth(0) | ||
| 46 | } | 52 | } |
| 47 | } | 53 | } |
| 48 | 54 | ||
