diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/nameres.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/nameres.rs b/crates/ra_analysis/src/descriptors/module/nameres.rs index 6251f5b86..6e327e374 100644 --- a/crates/ra_analysis/src/descriptors/module/nameres.rs +++ b/crates/ra_analysis/src/descriptors/module/nameres.rs | |||
@@ -24,7 +24,7 @@ use rustc_hash::FxHashMap; | |||
24 | use ra_syntax::{ | 24 | use ra_syntax::{ |
25 | SyntaxNode, | 25 | SyntaxNode, |
26 | SmolStr, SyntaxKind::{self, *}, | 26 | SmolStr, SyntaxKind::{self, *}, |
27 | ast::{self, ModuleItemOwner} | 27 | ast::{self, ModuleItemOwner, AstNode} |
28 | }; | 28 | }; |
29 | 29 | ||
30 | use crate::{ | 30 | use crate::{ |
@@ -44,7 +44,13 @@ use crate::{ | |||
44 | pub(crate) struct FileItemId(u32); | 44 | pub(crate) struct FileItemId(u32); |
45 | 45 | ||
46 | pub(crate) fn file_items(db: &impl DescriptorDatabase, file_id: FileId) -> Arc<Vec<SyntaxNode>> { | 46 | pub(crate) fn file_items(db: &impl DescriptorDatabase, file_id: FileId) -> Arc<Vec<SyntaxNode>> { |
47 | unimplemented!() | 47 | let source_file = db.file_syntax(file_id); |
48 | let source_file = source_file.borrowed(); | ||
49 | let res = source_file.syntax().descendants() | ||
50 | .filter_map(ast::ModuleItem::cast) | ||
51 | .map(|it| it.syntax().owned()) | ||
52 | .collect::<Vec<_>>(); | ||
53 | Arc::new(res) | ||
48 | } | 54 | } |
49 | 55 | ||
50 | pub(crate) fn file_item(db: &impl DescriptorDatabase, file_id: FileId, file_item_id: FileItemId) -> SyntaxNode { | 56 | pub(crate) fn file_item(db: &impl DescriptorDatabase, file_id: FileId, file_item_id: FileItemId) -> SyntaxNode { |