aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/descriptors/module
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-27 11:04:25 +0000
committerAleksey Kladov <[email protected]>2018-11-27 12:01:52 +0000
commit4d87799a4a73e5a58fce4e3caa88ad90347bdabb (patch)
tree89086baaea84df4702e841ed051768e139242b7a /crates/ra_analysis/src/descriptors/module
parent16cdd126b61086513c1b6049a80a7d64fc1d0f60 (diff)
implement file_items
Diffstat (limited to 'crates/ra_analysis/src/descriptors/module')
-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 {