diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_dot.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index aaf739500..e1c0d26c7 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -31,7 +31,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) | |||
31 | for field in s.fields(ctx.db) { | 31 | for field in s.fields(ctx.db) { |
32 | CompletionItem::new( | 32 | CompletionItem::new( |
33 | CompletionKind::Reference, | 33 | CompletionKind::Reference, |
34 | ctx, | 34 | ctx.leaf_range(), |
35 | field.name().to_string(), | 35 | field.name().to_string(), |
36 | ) | 36 | ) |
37 | .kind(CompletionItemKind::Field) | 37 | .kind(CompletionItemKind::Field) |
@@ -45,7 +45,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) | |||
45 | } | 45 | } |
46 | Ty::Tuple(fields) => { | 46 | Ty::Tuple(fields) => { |
47 | for (i, _ty) in fields.iter().enumerate() { | 47 | for (i, _ty) in fields.iter().enumerate() { |
48 | CompletionItem::new(CompletionKind::Reference, ctx, i.to_string()) | 48 | CompletionItem::new(CompletionKind::Reference, ctx.leaf_range(), i.to_string()) |
49 | .kind(CompletionItemKind::Field) | 49 | .kind(CompletionItemKind::Field) |
50 | .add_to(acc); | 50 | .add_to(acc); |
51 | } | 51 | } |
@@ -59,10 +59,14 @@ fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty | |||
59 | receiver.iterate_methods(ctx.db, |func| { | 59 | receiver.iterate_methods(ctx.db, |func| { |
60 | let sig = func.signature(ctx.db); | 60 | let sig = func.signature(ctx.db); |
61 | if sig.has_self_param() { | 61 | if sig.has_self_param() { |
62 | CompletionItem::new(CompletionKind::Reference, ctx, sig.name().to_string()) | 62 | CompletionItem::new( |
63 | .from_function(ctx, func) | 63 | CompletionKind::Reference, |
64 | .kind(CompletionItemKind::Method) | 64 | ctx.leaf_range(), |
65 | .add_to(acc); | 65 | sig.name().to_string(), |
66 | ) | ||
67 | .from_function(ctx, func) | ||
68 | .kind(CompletionItemKind::Method) | ||
69 | .add_to(acc); | ||
66 | } | 70 | } |
67 | None::<()> | 71 | None::<()> |
68 | }); | 72 | }); |