From fbbee537228538f448a335bb0b2dabec2b3d443e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 31 Oct 2018 02:08:54 +0300 Subject: Add ModuleScope as a query This is a first step towards queryifing completion and resolve. Some code currently duplicates ra_editor: the plan is to move all completion from ra_editor, but it'll take more than one commit. --- crates/ra_analysis/src/descriptors/module/imp.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'crates/ra_analysis/src/descriptors/module/imp.rs') diff --git a/crates/ra_analysis/src/descriptors/module/imp.rs b/crates/ra_analysis/src/descriptors/module/imp.rs index aecf6e29a..5fdaad137 100644 --- a/crates/ra_analysis/src/descriptors/module/imp.rs +++ b/crates/ra_analysis/src/descriptors/module/imp.rs @@ -13,7 +13,7 @@ use crate::{ }; use super::{ - ModuleData, ModuleTree, ModuleId, LinkId, LinkData, Problem, ModulesDatabase + ModuleData, ModuleTree, ModuleId, LinkId, LinkData, Problem, ModulesDatabase, ModuleScope }; @@ -35,6 +35,18 @@ pub(super) fn modules(root: ast::Root<'_>) -> impl Iterator Cancelable> { + let tree = db.module_tree(source_root_id)?; + let file_id = module_id.file_id(&tree); + let syntax = db.file_syntax(file_id); + let res = ModuleScope::new(&syntax); + Ok(Arc::new(res)) +} + pub(super) fn module_tree( db: &impl ModulesDatabase, source_root: SourceRootId, -- cgit v1.2.3