diff options
author | Aleksey Kladov <[email protected]> | 2019-01-24 21:50:08 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-24 21:50:08 +0000 |
commit | 1db2cbcb8bd61b4f19f61cc6319343e5ad894515 (patch) | |
tree | 1769ced52f4e298773b8fee9fab79b691ddb5f04 /crates/ra_ide_api | |
parent | f588535273db261c32e23c1b0221d03ad82cd94d (diff) |
move consts&statics to new id
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_item.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/navigation_target.rs | 22 |
3 files changed, 18 insertions, 10 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 4768efdc1..bd5484516 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -43,6 +43,8 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
43 | hir::ModuleDef::Function(_) | 43 | hir::ModuleDef::Function(_) |
44 | | hir::ModuleDef::Struct(_) | 44 | | hir::ModuleDef::Struct(_) |
45 | | hir::ModuleDef::Def(_) | 45 | | hir::ModuleDef::Def(_) |
46 | | hir::ModuleDef::Const(_) | ||
47 | | hir::ModuleDef::Static(_) | ||
46 | | hir::ModuleDef::EnumVariant(_) => return, | 48 | | hir::ModuleDef::EnumVariant(_) => return, |
47 | }; | 49 | }; |
48 | } | 50 | } |
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index ee1f8bce0..2f8ec41d2 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs | |||
@@ -223,11 +223,11 @@ impl Builder { | |||
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::EnumVariant(it) => (CompletionItemKind::EnumVariant, it.docs(ctx.db)), |
226 | hir::ModuleDef::Const(it) => (CompletionItemKind::Const, it.docs(ctx.db)), | ||
227 | hir::ModuleDef::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)), | ||
226 | hir::ModuleDef::Def(def_id) => match def_id.resolve(ctx.db) { | 228 | hir::ModuleDef::Def(def_id) => match def_id.resolve(ctx.db) { |
227 | hir::Def::Trait(it) => (CompletionItemKind::Trait, it.docs(ctx.db)), | 229 | hir::Def::Trait(it) => (CompletionItemKind::Trait, it.docs(ctx.db)), |
228 | hir::Def::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)), | 230 | hir::Def::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)), |
229 | hir::Def::Const(it) => (CompletionItemKind::Const, it.docs(ctx.db)), | ||
230 | hir::Def::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)), | ||
231 | _ => return self, | 231 | _ => return self, |
232 | }, | 232 | }, |
233 | }; | 233 | }; |
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index fc76338d2..8406fee31 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs | |||
@@ -121,6 +121,20 @@ impl NavigationTarget { | |||
121 | &*node, | 121 | &*node, |
122 | )); | 122 | )); |
123 | } | 123 | } |
124 | hir::ModuleDef::Const(s) => { | ||
125 | let (file_id, node) = s.source(db); | ||
126 | return Some(NavigationTarget::from_named( | ||
127 | file_id.original_file(db), | ||
128 | &*node, | ||
129 | )); | ||
130 | } | ||
131 | hir::ModuleDef::Static(s) => { | ||
132 | let (file_id, node) = s.source(db); | ||
133 | return Some(NavigationTarget::from_named( | ||
134 | file_id.original_file(db), | ||
135 | &*node, | ||
136 | )); | ||
137 | } | ||
124 | hir::ModuleDef::Enum(e) => { | 138 | hir::ModuleDef::Enum(e) => { |
125 | let (file_id, node) = e.source(db); | 139 | let (file_id, node) = e.source(db); |
126 | return Some(NavigationTarget::from_named( | 140 | return Some(NavigationTarget::from_named( |
@@ -146,14 +160,6 @@ impl NavigationTarget { | |||
146 | let (file_id, node) = f.source(db); | 160 | let (file_id, node) = f.source(db); |
147 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 161 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
148 | } | 162 | } |
149 | Def::Static(f) => { | ||
150 | let (file_id, node) = f.source(db); | ||
151 | NavigationTarget::from_named(file_id.original_file(db), &*node) | ||
152 | } | ||
153 | Def::Const(f) => { | ||
154 | let (file_id, node) = f.source(db); | ||
155 | NavigationTarget::from_named(file_id.original_file(db), &*node) | ||
156 | } | ||
157 | Def::Item => return None, | 163 | Def::Item => return None, |
158 | }; | 164 | }; |
159 | Some(res) | 165 | Some(res) |