diff options
author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2018-10-31 17:59:17 +0000 |
---|---|---|
committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2018-10-31 18:01:51 +0000 |
commit | f3fb59d7077801a3a68d2d03eef17d59c2925ae8 (patch) | |
tree | 7665461636576d121063d7cc391351b284a399b9 /crates/ra_analysis/src/descriptors/module | |
parent | c02be1502c76cc504ccf7f73dce929585c94377c (diff) |
Move completion to ra_analysis
While we should handle completion for isolated file, it's better
achieved by using empty Analysis, rather than working only with &File:
we need memoization for type inference even inside a single file.
Diffstat (limited to 'crates/ra_analysis/src/descriptors/module')
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/scope.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/scope.rs b/crates/ra_analysis/src/descriptors/module/scope.rs index 0f8f325ab..846b8b44f 100644 --- a/crates/ra_analysis/src/descriptors/module/scope.rs +++ b/crates/ra_analysis/src/descriptors/module/scope.rs | |||
@@ -30,8 +30,12 @@ enum EntryKind { | |||
30 | 30 | ||
31 | impl ModuleScope { | 31 | impl ModuleScope { |
32 | pub fn new(file: &File) -> ModuleScope { | 32 | pub fn new(file: &File) -> ModuleScope { |
33 | ModuleScope::from_items(file.ast().items()) | ||
34 | } | ||
35 | |||
36 | pub fn from_items<'a>(items: impl Iterator<Item = ast::ModuleItem<'a>>) -> ModuleScope { | ||
33 | let mut entries = Vec::new(); | 37 | let mut entries = Vec::new(); |
34 | for item in file.ast().items() { | 38 | for item in items { |
35 | let entry = match item { | 39 | let entry = match item { |
36 | ast::ModuleItem::StructDef(item) => Entry::new(item), | 40 | ast::ModuleItem::StructDef(item) => Entry::new(item), |
37 | ast::ModuleItem::EnumDef(item) => Entry::new(item), | 41 | ast::ModuleItem::EnumDef(item) => Entry::new(item), |