aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/complete_path.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-13 14:25:40 +0100
committerGitHub <[email protected]>2019-09-13 14:25:40 +0100
commitb31f9872ec67d371d669967f9c95f2d71a9d6bf5 (patch)
tree989afd660d62db28196a8792cec2affb7bfd50a7 /crates/ra_ide_api/src/completion/complete_path.rs
parent1adf0519bcc8286c06e12aa7e5b16298addfea4a (diff)
parent51e2d76b9839410020c75ac02ad602675b0a5aa9 (diff)
Merge #1833
1833: Specify desirable namespace when calling resolve r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_path.rs')
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index 4d3414f33..5ee2864dc 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -1,4 +1,4 @@
1use hir::{Adt, Either, Resolution}; 1use hir::{Adt, Either, PathResolution};
2use ra_syntax::AstNode; 2use ra_syntax::AstNode;
3use test_utils::tested_by; 3use test_utils::tested_by;
4 4
@@ -9,15 +9,15 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
9 Some(path) => path.clone(), 9 Some(path) => path.clone(),
10 _ => return, 10 _ => return,
11 }; 11 };
12 let def = match ctx.analyzer.resolve_hir_path(ctx.db, &path).take_types() { 12 let def = match dbg!(ctx.analyzer.resolve_hir_path(ctx.db, &path)) {
13 Some(Resolution::Def(def)) => def, 13 Some(PathResolution::Def(def)) => def,
14 _ => return, 14 _ => return,
15 }; 15 };
16 match def { 16 match def {
17 hir::ModuleDef::Module(module) => { 17 hir::ModuleDef::Module(module) => {
18 let module_scope = module.scope(ctx.db); 18 let module_scope = module.scope(ctx.db);
19 for (name, res) in module_scope.entries() { 19 for (name, res) in module_scope.entries() {
20 if let Some(hir::ModuleDef::BuiltinType(..)) = res.def.as_ref().take_types() { 20 if let Some(hir::ModuleDef::BuiltinType(..)) = res.def.take_types() {
21 if ctx.use_item_syntax.is_some() { 21 if ctx.use_item_syntax.is_some() {
22 tested_by!(dont_complete_primitive_in_use); 22 tested_by!(dont_complete_primitive_in_use);
23 continue; 23 continue;
@@ -34,7 +34,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
34 } 34 }
35 } 35 }
36 } 36 }
37 acc.add_resolution(ctx, name.to_string(), &res.def.map(hir::Resolution::Def)); 37 acc.add_resolution(ctx, name.to_string(), &res.def.into());
38 } 38 }
39 } 39 }
40 hir::ModuleDef::Adt(_) | hir::ModuleDef::TypeAlias(_) => { 40 hir::ModuleDef::Adt(_) | hir::ModuleDef::TypeAlias(_) => {