diff options
Diffstat (limited to 'crates/ra_editor/src/symbols.rs')
-rw-r--r-- | crates/ra_editor/src/symbols.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_editor/src/symbols.rs b/crates/ra_editor/src/symbols.rs index f7681c76f..6d3b0514a 100644 --- a/crates/ra_editor/src/symbols.rs +++ b/crates/ra_editor/src/symbols.rs | |||
@@ -3,7 +3,7 @@ use crate::TextRange; | |||
3 | use ra_syntax::{ | 3 | use ra_syntax::{ |
4 | algo::visit::{visitor, Visitor}, | 4 | algo::visit::{visitor, Visitor}, |
5 | ast::{self, DocCommentsOwner, NameOwner}, | 5 | ast::{self, DocCommentsOwner, NameOwner}, |
6 | AstNode, File, SmolStr, SyntaxKind, SyntaxNodeRef, WalkEvent, | 6 | AstNode, SourceFileNode, SmolStr, SyntaxKind, SyntaxNodeRef, WalkEvent, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | #[derive(Debug, Clone)] | 9 | #[derive(Debug, Clone)] |
@@ -23,7 +23,7 @@ pub struct FileSymbol { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | impl FileSymbol { | 25 | impl FileSymbol { |
26 | pub fn docs(&self, file: &File) -> Option<String> { | 26 | pub fn docs(&self, file: &SourceFileNode) -> Option<String> { |
27 | file.syntax() | 27 | file.syntax() |
28 | .descendants() | 28 | .descendants() |
29 | .filter(|node| node.kind() == self.kind && node.range() == self.node_range) | 29 | .filter(|node| node.kind() == self.kind && node.range() == self.node_range) |
@@ -52,7 +52,7 @@ impl FileSymbol { | |||
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | pub fn file_symbols(file: &File) -> Vec<FileSymbol> { | 55 | pub fn file_symbols(file: &SourceFileNode) -> Vec<FileSymbol> { |
56 | file.syntax().descendants().filter_map(to_symbol).collect() | 56 | file.syntax().descendants().filter_map(to_symbol).collect() |
57 | } | 57 | } |
58 | 58 | ||
@@ -77,7 +77,7 @@ fn to_symbol(node: SyntaxNodeRef) -> Option<FileSymbol> { | |||
77 | .accept(node)? | 77 | .accept(node)? |
78 | } | 78 | } |
79 | 79 | ||
80 | pub fn file_structure(file: &File) -> Vec<StructureNode> { | 80 | pub fn file_structure(file: &SourceFileNode) -> Vec<StructureNode> { |
81 | let mut res = Vec::new(); | 81 | let mut res = Vec::new(); |
82 | let mut stack = Vec::new(); | 82 | let mut stack = Vec::new(); |
83 | 83 | ||
@@ -153,7 +153,7 @@ mod tests { | |||
153 | 153 | ||
154 | #[test] | 154 | #[test] |
155 | fn test_file_structure() { | 155 | fn test_file_structure() { |
156 | let file = File::parse( | 156 | let file = SourceFileNode::parse( |
157 | r#" | 157 | r#" |
158 | struct Foo { | 158 | struct Foo { |
159 | x: i32 | 159 | x: i32 |