aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/completion/completion_item.rs20
-rw-r--r--crates/ra_ide_api/src/navigation_target.rs16
2 files changed, 36 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs
index 6a9770429..e7fa967a0 100644
--- a/crates/ra_ide_api/src/completion/completion_item.rs
+++ b/crates/ra_ide_api/src/completion/completion_item.rs
@@ -33,6 +33,10 @@ pub enum CompletionItemKind {
33 EnumVariant, 33 EnumVariant,
34 Binding, 34 Binding,
35 Field, 35 Field,
36 Static,
37 Const,
38 Trait,
39 TypeAlias,
36} 40}
37 41
38#[derive(Debug, PartialEq, Eq)] 42#[derive(Debug, PartialEq, Eq)]
@@ -154,6 +158,22 @@ impl Builder {
154 .. 158 ..
155 } => CompletionItemKind::Enum, 159 } => CompletionItemKind::Enum,
156 PerNs { 160 PerNs {
161 types: Some(hir::Def::Trait(..)),
162 ..
163 } => CompletionItemKind::Trait,
164 PerNs {
165 types: Some(hir::Def::Type(..)),
166 ..
167 } => CompletionItemKind::TypeAlias,
168 PerNs {
169 values: Some(hir::Def::Const(..)),
170 ..
171 } => CompletionItemKind::Const,
172 PerNs {
173 values: Some(hir::Def::Static(..)),
174 ..
175 } => CompletionItemKind::Static,
176 PerNs {
157 values: Some(hir::Def::Function(function)), 177 values: Some(hir::Def::Function(function)),
158 .. 178 ..
159 } => return self.from_function(ctx, function), 179 } => return self.from_function(ctx, function),
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs
index b955bbe42..b0d0a3e8b 100644
--- a/crates/ra_ide_api/src/navigation_target.rs
+++ b/crates/ra_ide_api/src/navigation_target.rs
@@ -108,6 +108,22 @@ impl NavigationTarget {
108 let (file_id, node) = f.source(db)?; 108 let (file_id, node) = f.source(db)?;
109 NavigationTarget::from_named(file_id.original_file(db), &*node) 109 NavigationTarget::from_named(file_id.original_file(db), &*node)
110 } 110 }
111 Def::Trait(f) => {
112 let (file_id, node) = f.source(db)?;
113 NavigationTarget::from_named(file_id.original_file(db), &*node)
114 }
115 Def::Type(f) => {
116 let (file_id, node) = f.source(db)?;
117 NavigationTarget::from_named(file_id.original_file(db), &*node)
118 }
119 Def::Static(f) => {
120 let (file_id, node) = f.source(db)?;
121 NavigationTarget::from_named(file_id.original_file(db), &*node)
122 }
123 Def::Const(f) => {
124 let (file_id, node) = f.source(db)?;
125 NavigationTarget::from_named(file_id.original_file(db), &*node)
126 }
111 Def::Module(m) => NavigationTarget::from_module(db, m)?, 127 Def::Module(m) => NavigationTarget::from_module(db, m)?,
112 Def::Item => return Ok(None), 128 Def::Item => return Ok(None),
113 }; 129 };