diff options
author | Aleksey Kladov <[email protected]> | 2018-11-27 10:58:42 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-11-27 12:01:52 +0000 |
commit | 16cdd126b61086513c1b6049a80a7d64fc1d0f60 (patch) | |
tree | 14adba610376ff72a76f515f3ccb95c42b0d7174 /crates/ra_analysis/src/descriptors/module | |
parent | 8e37208040a456d4e481472f69b3b584655ee90f (diff) |
add file items query
Diffstat (limited to 'crates/ra_analysis/src/descriptors/module')
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/nameres.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/nameres.rs b/crates/ra_analysis/src/descriptors/module/nameres.rs index 648ec5e43..6251f5b86 100644 --- a/crates/ra_analysis/src/descriptors/module/nameres.rs +++ b/crates/ra_analysis/src/descriptors/module/nameres.rs | |||
@@ -22,12 +22,13 @@ use std::{ | |||
22 | use rustc_hash::FxHashMap; | 22 | use rustc_hash::FxHashMap; |
23 | 23 | ||
24 | use ra_syntax::{ | 24 | use ra_syntax::{ |
25 | SyntaxNode, | ||
25 | SmolStr, SyntaxKind::{self, *}, | 26 | SmolStr, SyntaxKind::{self, *}, |
26 | ast::{self, ModuleItemOwner} | 27 | ast::{self, ModuleItemOwner} |
27 | }; | 28 | }; |
28 | 29 | ||
29 | use crate::{ | 30 | use crate::{ |
30 | Cancelable, | 31 | Cancelable, FileId, |
31 | loc2id::{DefId, DefLoc}, | 32 | loc2id::{DefId, DefLoc}, |
32 | descriptors::{ | 33 | descriptors::{ |
33 | Path, PathKind, | 34 | Path, PathKind, |
@@ -38,6 +39,20 @@ use crate::{ | |||
38 | input::SourceRootId, | 39 | input::SourceRootId, |
39 | }; | 40 | }; |
40 | 41 | ||
42 | |||
43 | #[derive(Clone, Copy, Hash, PartialEq, Eq, Debug)] | ||
44 | pub(crate) struct FileItemId(u32); | ||
45 | |||
46 | pub(crate) fn file_items(db: &impl DescriptorDatabase, file_id: FileId) -> Arc<Vec<SyntaxNode>> { | ||
47 | unimplemented!() | ||
48 | } | ||
49 | |||
50 | pub(crate) fn file_item(db: &impl DescriptorDatabase, file_id: FileId, file_item_id: FileItemId) -> SyntaxNode { | ||
51 | let items = db._file_items(file_id); | ||
52 | let idx = file_item_id.0 as usize; | ||
53 | items[idx].clone() | ||
54 | } | ||
55 | |||
41 | /// Item map is the result of the name resolution. Item map contains, for each | 56 | /// Item map is the result of the name resolution. Item map contains, for each |
42 | /// module, the set of visible items. | 57 | /// module, the set of visible items. |
43 | #[derive(Default, Debug, PartialEq, Eq)] | 58 | #[derive(Default, Debug, PartialEq, Eq)] |