diff options
author | Aleksey Kladov <[email protected]> | 2018-11-27 11:04:25 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-11-27 12:01:52 +0000 |
commit | 4d87799a4a73e5a58fce4e3caa88ad90347bdabb (patch) | |
tree | 89086baaea84df4702e841ed051768e139242b7a /crates/ra_analysis/src/descriptors/module | |
parent | 16cdd126b61086513c1b6049a80a7d64fc1d0f60 (diff) |
implement file_items
Diffstat (limited to 'crates/ra_analysis/src/descriptors/module')
-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 { |