From 4d75430e912491c19fb1a7b1a95ee812f6a8a124 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 31 Dec 2019 16:17:08 +0100 Subject: Qualify some paths in 'add missing impl members' --- crates/ra_hir/src/code_model.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'crates/ra_hir/src/code_model.rs') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index cc42068a1..4da3db0d6 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -227,6 +227,19 @@ impl Module { pub(crate) fn with_module_id(self, module_id: LocalModuleId) -> Module { Module::new(self.krate(), module_id) } + + pub fn find_path( + self, + db: &impl DefDatabase, + item: ModuleDef, + ) -> Option { + // FIXME expose namespace choice + hir_def::find_path::find_path( + db, + hir_def::item_scope::ItemInNs::Types(item.into()), + self.into(), + ) + } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -- cgit v1.2.3 From 4496e2a06a91e5825f355ce730af802643e8018a Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 10 Jan 2020 18:40:45 +0100 Subject: Apply review suggestions --- crates/ra_hir/src/code_model.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/code_model.rs') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 4da3db0d6..df9c151e5 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -228,7 +228,9 @@ impl Module { Module::new(self.krate(), module_id) } - pub fn find_path( + /// Finds a path that can be used to refer to the given item from within + /// this module, if possible. + pub fn find_use_path( self, db: &impl DefDatabase, item: ModuleDef, -- cgit v1.2.3