aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src')
-rw-r--r--crates/ra_analysis/src/descriptors/module/nameres.rs10
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;
24use ra_syntax::{ 24use 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
30use crate::{ 30use crate::{
@@ -44,7 +44,13 @@ use crate::{
44pub(crate) struct FileItemId(u32); 44pub(crate) struct FileItemId(u32);
45 45
46pub(crate) fn file_items(db: &impl DescriptorDatabase, file_id: FileId) -> Arc<Vec<SyntaxNode>> { 46pub(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
50pub(crate) fn file_item(db: &impl DescriptorDatabase, file_id: FileId, file_item_id: FileItemId) -> SyntaxNode { 56pub(crate) fn file_item(db: &impl DescriptorDatabase, file_id: FileId, file_item_id: FileItemId) -> SyntaxNode {