diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index f26fd06b3..40bd1e75e 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -37,8 +37,8 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) | |||
37 | 37 | ||
38 | fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) { | 38 | fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) { |
39 | ctx.analyzer.iterate_method_candidates(ctx.db, receiver, None, |_ty, func| { | 39 | ctx.analyzer.iterate_method_candidates(ctx.db, receiver, None, |_ty, func| { |
40 | let sig = func.signature(ctx.db); | 40 | let data = func.data(ctx.db); |
41 | if sig.has_self_param() { | 41 | if data.has_self_param() { |
42 | acc.add_function(ctx, func); | 42 | acc.add_function(ctx, func); |
43 | } | 43 | } |
44 | None::<()> | 44 | None::<()> |
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 99da24142..c14af593b 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -49,8 +49,8 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
49 | ty.iterate_impl_items(ctx.db, krate, |item| { | 49 | ty.iterate_impl_items(ctx.db, krate, |item| { |
50 | match item { | 50 | match item { |
51 | hir::ImplItem::Method(func) => { | 51 | hir::ImplItem::Method(func) => { |
52 | let sig = func.signature(ctx.db); | 52 | let data = func.data(ctx.db); |
53 | if !sig.has_self_param() { | 53 | if !data.has_self_param() { |
54 | acc.add_function(ctx, func); | 54 | acc.add_function(ctx, func); |
55 | } | 55 | } |
56 | } | 56 | } |
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index f4ff4404b..973936736 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -98,13 +98,13 @@ impl Completions { | |||
98 | name: Option<String>, | 98 | name: Option<String>, |
99 | func: hir::Function, | 99 | func: hir::Function, |
100 | ) { | 100 | ) { |
101 | let sig = func.signature(ctx.db); | 101 | let data = func.data(ctx.db); |
102 | let name = name.unwrap_or_else(|| sig.name().to_string()); | 102 | let name = name.unwrap_or_else(|| data.name().to_string()); |
103 | let ast_node = func.source(ctx.db).ast; | 103 | let ast_node = func.source(ctx.db).ast; |
104 | let detail = function_label(&ast_node); | 104 | let detail = function_label(&ast_node); |
105 | 105 | ||
106 | let mut builder = CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name) | 106 | let mut builder = CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name) |
107 | .kind(if sig.has_self_param() { | 107 | .kind(if data.has_self_param() { |
108 | CompletionItemKind::Method | 108 | CompletionItemKind::Method |
109 | } else { | 109 | } else { |
110 | CompletionItemKind::Function | 110 | CompletionItemKind::Function |
@@ -115,10 +115,10 @@ impl Completions { | |||
115 | if ctx.use_item_syntax.is_none() && !ctx.is_call { | 115 | if ctx.use_item_syntax.is_none() && !ctx.is_call { |
116 | tested_by!(inserts_parens_for_function_calls); | 116 | tested_by!(inserts_parens_for_function_calls); |
117 | let snippet = | 117 | let snippet = |
118 | if sig.params().is_empty() || sig.has_self_param() && sig.params().len() == 1 { | 118 | if data.params().is_empty() || data.has_self_param() && data.params().len() == 1 { |
119 | format!("{}()$0", sig.name()) | 119 | format!("{}()$0", data.name()) |
120 | } else { | 120 | } else { |
121 | format!("{}($0)", sig.name()) | 121 | format!("{}($0)", data.name()) |
122 | }; | 122 | }; |
123 | builder = builder.insert_snippet(snippet); | 123 | builder = builder.insert_snippet(snippet); |
124 | } | 124 | } |