diff options
author | Aleksey Kladov <[email protected]> | 2019-01-24 20:36:16 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-24 20:36:16 +0000 |
commit | 6a5a1f590201ba962a1f77ce1a7ff5870712728d (patch) | |
tree | fc7bbab600b4bbf025476b39885ebee61a0d1710 /crates/ra_ide_api | |
parent | 4c514a3e02b019cdd3a17c9bcd78d93c210ab267 (diff) |
adapt ide_api to the new API
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 5 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_item.rs | 1 | ||||
-rw-r--r-- | crates/ra_ide_api/src/navigation_target.rs | 11 |
3 files changed, 12 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 e039a333c..4768efdc1 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -40,7 +40,10 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
40 | .add_to(acc) | 40 | .add_to(acc) |
41 | }); | 41 | }); |
42 | } | 42 | } |
43 | hir::ModuleDef::Function(_) | hir::ModuleDef::Struct(_) | hir::ModuleDef::Def(_) => return, | 43 | hir::ModuleDef::Function(_) |
44 | | hir::ModuleDef::Struct(_) | ||
45 | | hir::ModuleDef::Def(_) | ||
46 | | hir::ModuleDef::EnumVariant(_) => return, | ||
44 | }; | 47 | }; |
45 | } | 48 | } |
46 | 49 | ||
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index f2301653a..ee1f8bce0 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs | |||
@@ -222,6 +222,7 @@ impl Builder { | |||
222 | hir::ModuleDef::Function(func) => return self.from_function(ctx, func), | 222 | hir::ModuleDef::Function(func) => return self.from_function(ctx, func), |
223 | hir::ModuleDef::Struct(it) => (CompletionItemKind::Struct, it.docs(ctx.db)), | 223 | hir::ModuleDef::Struct(it) => (CompletionItemKind::Struct, it.docs(ctx.db)), |
224 | hir::ModuleDef::Enum(it) => (CompletionItemKind::Enum, it.docs(ctx.db)), | 224 | hir::ModuleDef::Enum(it) => (CompletionItemKind::Enum, it.docs(ctx.db)), |
225 | hir::ModuleDef::EnumVariant(it) => (CompletionItemKind::EnumVariant, it.docs(ctx.db)), | ||
225 | hir::ModuleDef::Def(def_id) => match def_id.resolve(ctx.db) { | 226 | hir::ModuleDef::Def(def_id) => match def_id.resolve(ctx.db) { |
226 | hir::Def::Trait(it) => (CompletionItemKind::Trait, it.docs(ctx.db)), | 227 | hir::Def::Trait(it) => (CompletionItemKind::Trait, it.docs(ctx.db)), |
227 | hir::Def::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)), | 228 | hir::Def::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)), |
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index b92670f36..fc76338d2 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs | |||
@@ -128,13 +128,16 @@ impl NavigationTarget { | |||
128 | &*node, | 128 | &*node, |
129 | )); | 129 | )); |
130 | } | 130 | } |
131 | hir::ModuleDef::EnumVariant(var) => { | ||
132 | let (file_id, node) = var.source(db); | ||
133 | return Some(NavigationTarget::from_named( | ||
134 | file_id.original_file(db), | ||
135 | &*node, | ||
136 | )); | ||
137 | } | ||
131 | }; | 138 | }; |
132 | 139 | ||
133 | let res = match def { | 140 | let res = match def { |
134 | Def::EnumVariant(ev) => { | ||
135 | let (file_id, node) = ev.source(db); | ||
136 | NavigationTarget::from_named(file_id.original_file(db), &*node) | ||
137 | } | ||
138 | Def::Trait(f) => { | 141 | Def::Trait(f) => { |
139 | let (file_id, node) = f.source(db); | 142 | let (file_id, node) = f.source(db); |
140 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 143 | NavigationTarget::from_named(file_id.original_file(db), &*node) |