aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/complete_path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_path.rs')
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index 7413c71e8..513a2ee89 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -15,18 +15,26 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
15 hir::Def::Module(module) => { 15 hir::Def::Module(module) => {
16 let module_scope = module.scope(ctx.db); 16 let module_scope = module.scope(ctx.db);
17 for (name, res) in module_scope.entries() { 17 for (name, res) in module_scope.entries() {
18 CompletionItem::new(CompletionKind::Reference, ctx, name.to_string()) 18 CompletionItem::new(
19 .from_resolution(ctx, res) 19 CompletionKind::Reference,
20 .add_to(acc); 20 ctx.leaf_range(),
21 name.to_string(),
22 )
23 .from_resolution(ctx, res)
24 .add_to(acc);
21 } 25 }
22 } 26 }
23 hir::Def::Enum(e) => { 27 hir::Def::Enum(e) => {
24 e.variants(ctx.db) 28 e.variants(ctx.db)
25 .into_iter() 29 .into_iter()
26 .for_each(|(variant_name, _variant)| { 30 .for_each(|(variant_name, _variant)| {
27 CompletionItem::new(CompletionKind::Reference, ctx, variant_name.to_string()) 31 CompletionItem::new(
28 .kind(CompletionItemKind::EnumVariant) 32 CompletionKind::Reference,
29 .add_to(acc) 33 ctx.leaf_range(),
34 variant_name.to_string(),
35 )
36 .kind(CompletionItemKind::EnumVariant)
37 .add_to(acc)
30 }); 38 });
31 } 39 }
32 _ => return, 40 _ => return,