diff options
author | Aleksey Kladov <[email protected]> | 2019-01-24 16:04:02 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-24 16:04:02 +0000 |
commit | aea1f95a665b56da5953907a122475db0c9a9c44 (patch) | |
tree | 3275d375e9ce9307ac4d9a54678b0ee541207d3b /crates/ra_ide_api/src/completion/complete_path.rs | |
parent | ce2041252aba52662945e36a4afad454d19388ae (diff) |
adapt ide_api to the new API
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_path.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 3aef479d9..e039a333c 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -26,26 +26,21 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
26 | .add_to(acc); | 26 | .add_to(acc); |
27 | } | 27 | } |
28 | } | 28 | } |
29 | 29 | hir::ModuleDef::Enum(e) => { | |
30 | hir::ModuleDef::Def(def_id) => match def_id.resolve(ctx.db) { | 30 | e.variants(ctx.db) |
31 | hir::Def::Enum(e) => { | 31 | .into_iter() |
32 | e.variants(ctx.db) | 32 | .for_each(|(variant_name, variant)| { |
33 | .into_iter() | 33 | CompletionItem::new( |
34 | .for_each(|(variant_name, variant)| { | 34 | CompletionKind::Reference, |
35 | CompletionItem::new( | 35 | ctx.source_range(), |
36 | CompletionKind::Reference, | 36 | variant_name.to_string(), |
37 | ctx.source_range(), | 37 | ) |
38 | variant_name.to_string(), | 38 | .kind(CompletionItemKind::EnumVariant) |
39 | ) | 39 | .set_documentation(variant.docs(ctx.db)) |
40 | .kind(CompletionItemKind::EnumVariant) | 40 | .add_to(acc) |
41 | .set_documentation(variant.docs(ctx.db)) | 41 | }); |
42 | .add_to(acc) | 42 | } |
43 | }); | 43 | hir::ModuleDef::Function(_) | hir::ModuleDef::Struct(_) | hir::ModuleDef::Def(_) => return, |
44 | } | ||
45 | _ => return, | ||
46 | }, | ||
47 | |||
48 | hir::ModuleDef::Function(_) => return, | ||
49 | }; | 44 | }; |
50 | } | 45 | } |
51 | 46 | ||