aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-16 21:05:43 +0100
committerAleksey Kladov <[email protected]>2020-07-16 21:17:49 +0100
commit3823c2dc1995ec261e36435662b8802c714e23d4 (patch)
tree74f7814de8380f97c645afbfe3dad7d924785fcb /crates/ra_ide/src/completion
parenta5ae8b8b92748e1b876002799d160136a7836212 (diff)
Remove FunctionSignature
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r--crates/ra_ide/src/completion/presentation.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index 6aab93e17..c7b74e635 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -11,10 +11,7 @@ use crate::{
11 completion_item::Builder, CompletionContext, CompletionItem, CompletionItemKind, 11 completion_item::Builder, CompletionContext, CompletionItem, CompletionItemKind,
12 CompletionKind, Completions, 12 CompletionKind, Completions,
13 }, 13 },
14 display::{ 14 display::{const_label, function_declaration, macro_label, type_label},
15 const_label, function_declaration, function_signature::FunctionSignature, macro_label,
16 type_label,
17 },
18 CompletionScore, RootDatabase, 15 CompletionScore, RootDatabase,
19}; 16};
20 17
@@ -198,7 +195,6 @@ impl Completions {
198 195
199 let name = local_name.unwrap_or_else(|| func.name(ctx.db).to_string()); 196 let name = local_name.unwrap_or_else(|| func.name(ctx.db).to_string());
200 let ast_node = func.source(ctx.db).value; 197 let ast_node = func.source(ctx.db).value;
201 let function_signature = FunctionSignature::from(&ast_node);
202 198
203 let mut builder = 199 let mut builder =
204 CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name.clone()) 200 CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name.clone())
@@ -211,11 +207,12 @@ impl Completions {
211 .set_deprecated(is_deprecated(func, ctx.db)) 207 .set_deprecated(is_deprecated(func, ctx.db))
212 .detail(function_declaration(&ast_node)); 208 .detail(function_declaration(&ast_node));
213 209
214 let params = function_signature 210 let params = ast_node
215 .parameter_names 211 .param_list()
216 .iter() 212 .into_iter()
217 .skip(if function_signature.has_self_param { 1 } else { 0 }) 213 .flat_map(|it| it.params())
218 .map(|name| name.trim_start_matches('_').into()) 214 .flat_map(|it| it.pat())
215 .map(|pat| pat.to_string().trim_start_matches('_').into())
219 .collect(); 216 .collect();
220 217
221 builder = builder.add_call_parens(ctx, name, Params::Named(params)); 218 builder = builder.add_call_parens(ctx, name, Params::Named(params));