aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorJeremy A. Kolb <[email protected]>2019-01-23 22:46:14 +0000
committerJeremy A. Kolb <[email protected]>2019-01-23 22:46:14 +0000
commit7b548de63405a07c1a4aa6aedb3e1993fe6b1e6c (patch)
tree2b9a86431dd1b8ee4298f35bc991ddd0803016fb /crates/ra_ide_api/src
parent576625f0a1c6e54075d173db7e691d75077ca677 (diff)
Add a bunch of new documentation to completions
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/completion/completion_item.rs30
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__reference_completion.snap20
2 files changed, 30 insertions, 20 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs
index 8e0be4c4b..18c151932 100644
--- a/crates/ra_ide_api/src/completion/completion_item.rs
+++ b/crates/ra_ide_api/src/completion/completion_item.rs
@@ -210,35 +210,35 @@ impl Builder {
210 resolution: &hir::Resolution, 210 resolution: &hir::Resolution,
211 ) -> Builder { 211 ) -> Builder {
212 let resolved = resolution.def_id.map(|d| d.resolve(ctx.db)); 212 let resolved = resolution.def_id.map(|d| d.resolve(ctx.db));
213 let kind = match resolved { 213 let (kind, docs) = match resolved {
214 PerNs { 214 PerNs {
215 types: Some(hir::Def::Module(..)), 215 types: Some(hir::Def::Module(..)),
216 .. 216 ..
217 } => CompletionItemKind::Module, 217 } => (CompletionItemKind::Module, None),
218 PerNs { 218 PerNs {
219 types: Some(hir::Def::Struct(..)), 219 types: Some(hir::Def::Struct(s)),
220 .. 220 ..
221 } => CompletionItemKind::Struct, 221 } => (CompletionItemKind::Struct, s.docs(ctx.db)),
222 PerNs { 222 PerNs {
223 types: Some(hir::Def::Enum(..)), 223 types: Some(hir::Def::Enum(e)),
224 .. 224 ..
225 } => CompletionItemKind::Enum, 225 } => (CompletionItemKind::Enum, e.docs(ctx.db)),
226 PerNs { 226 PerNs {
227 types: Some(hir::Def::Trait(..)), 227 types: Some(hir::Def::Trait(t)),
228 .. 228 ..
229 } => CompletionItemKind::Trait, 229 } => (CompletionItemKind::Trait, t.docs(ctx.db)),
230 PerNs { 230 PerNs {
231 types: Some(hir::Def::Type(..)), 231 types: Some(hir::Def::Type(t)),
232 .. 232 ..
233 } => CompletionItemKind::TypeAlias, 233 } => (CompletionItemKind::TypeAlias, t.docs(ctx.db)),
234 PerNs { 234 PerNs {
235 values: Some(hir::Def::Const(..)), 235 values: Some(hir::Def::Const(c)),
236 .. 236 ..
237 } => CompletionItemKind::Const, 237 } => (CompletionItemKind::Const, c.docs(ctx.db)),
238 PerNs { 238 PerNs {
239 values: Some(hir::Def::Static(..)), 239 values: Some(hir::Def::Static(s)),
240 .. 240 ..
241 } => CompletionItemKind::Static, 241 } => (CompletionItemKind::Static, s.docs(ctx.db)),
242 PerNs { 242 PerNs {
243 values: Some(hir::Def::Function(function)), 243 values: Some(hir::Def::Function(function)),
244 .. 244 ..
@@ -246,6 +246,8 @@ impl Builder {
246 _ => return self, 246 _ => return self,
247 }; 247 };
248 self.kind = Some(kind); 248 self.kind = Some(kind);
249 self.documentation = docs;
250
249 self 251 self
250 } 252 }
251 253
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__reference_completion.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__reference_completion.snap
index 0180a4f44..9779541b3 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__reference_completion.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__reference_completion.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-01-22T14:45:00.717917+00:00" 2created: "2019-01-23T21:14:09.186661600+00:00"
3creator: insta@0.4.0 3creator: insta@0.5.1
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
6--- 6---
@@ -12,11 +12,15 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
12 EnumVariant 12 EnumVariant
13 ), 13 ),
14 detail: None, 14 detail: None,
15 documentation: None, 15 documentation: Some(
16 Documentation(
17 "This is foo"
18 )
19 ),
16 lookup: None, 20 lookup: None,
17 insert_text: None, 21 insert_text: None,
18 insert_text_format: PlainText, 22 insert_text_format: PlainText,
19 source_range: [47; 47), 23 source_range: [109; 109),
20 text_edit: None 24 text_edit: None
21 }, 25 },
22 CompletionItem { 26 CompletionItem {
@@ -26,11 +30,15 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
26 EnumVariant 30 EnumVariant
27 ), 31 ),
28 detail: None, 32 detail: None,
29 documentation: None, 33 documentation: Some(
34 Documentation(
35 "Use when we need an `i32`"
36 )
37 ),
30 lookup: None, 38 lookup: None,
31 insert_text: None, 39 insert_text: None,
32 insert_text_format: PlainText, 40 insert_text_format: PlainText,
33 source_range: [47; 47), 41 source_range: [109; 109),
34 text_edit: None 42 text_edit: None
35 } 43 }
36] 44]