diff options
Diffstat (limited to 'crates/ra_ide/src/completion/presentation.rs')
-rw-r--r-- | crates/ra_ide/src/completion/presentation.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index a524987fd..ae9344a44 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs | |||
@@ -193,11 +193,10 @@ impl Completions { | |||
193 | name: Option<String>, | 193 | name: Option<String>, |
194 | func: hir::Function, | 194 | func: hir::Function, |
195 | ) { | 195 | ) { |
196 | let func_name = func.name(ctx.db); | ||
197 | let has_self_param = func.has_self_param(ctx.db); | 196 | let has_self_param = func.has_self_param(ctx.db); |
198 | let params = func.params(ctx.db); | 197 | let params = func.params(ctx.db); |
199 | 198 | ||
200 | let name = name.unwrap_or_else(|| func_name.to_string()); | 199 | let name = name.unwrap_or_else(|| func.name(ctx.db).to_string()); |
201 | let ast_node = func.source(ctx.db).value; | 200 | let ast_node = func.source(ctx.db).value; |
202 | let detail = function_label(&ast_node); | 201 | let detail = function_label(&ast_node); |
203 | 202 | ||
@@ -219,9 +218,9 @@ impl Completions { | |||
219 | { | 218 | { |
220 | tested_by!(inserts_parens_for_function_calls); | 219 | tested_by!(inserts_parens_for_function_calls); |
221 | let (snippet, label) = if params.is_empty() || has_self_param && params.len() == 1 { | 220 | let (snippet, label) = if params.is_empty() || has_self_param && params.len() == 1 { |
222 | (format!("{}()$0", func_name), format!("{}()", name)) | 221 | (format!("{}()$0", name), format!("{}()", name)) |
223 | } else { | 222 | } else { |
224 | (format!("{}($0)", func_name), format!("{}(…)", name)) | 223 | (format!("{}($0)", name), format!("{}(…)", name)) |
225 | }; | 224 | }; |
226 | builder = builder.lookup_by(name).label(label).insert_snippet(snippet); | 225 | builder = builder.lookup_by(name).label(label).insert_snippet(snippet); |
227 | } | 226 | } |