aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/presentation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion/presentation.rs')
-rw-r--r--crates/ra_ide_api/src/completion/presentation.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs
index 175a27ba9..20242d293 100644
--- a/crates/ra_ide_api/src/completion/presentation.rs
+++ b/crates/ra_ide_api/src/completion/presentation.rs
@@ -188,16 +188,13 @@ impl Completions {
188 && ctx.db.feature_flags.get("completion.insertion.add-call-parenthesis") 188 && ctx.db.feature_flags.get("completion.insertion.add-call-parenthesis")
189 { 189 {
190 tested_by!(inserts_parens_for_function_calls); 190 tested_by!(inserts_parens_for_function_calls);
191 let snippet = 191 let (snippet, label) =
192 if data.params().is_empty() || data.has_self_param() && data.params().len() == 1 { 192 if data.params().is_empty() || data.has_self_param() && data.params().len() == 1 {
193 format!("{}()$0", data.name()) 193 (format!("{}()$0", data.name()), format!("{}()", name))
194 } else { 194 } else {
195 format!("{}($0)", data.name()) 195 (format!("{}($0)", data.name()), format!("{}(…)", name))
196 }; 196 };
197 builder = builder 197 builder = builder.lookup_by(name.clone()).label(label).insert_snippet(snippet);
198 .lookup_by(name.clone())
199 .label(format!("{}(…)", name))
200 .insert_snippet(snippet);
201 } 198 }
202 199
203 self.add(builder) 200 self.add(builder)
@@ -279,7 +276,7 @@ mod tests {
279 @r###" 276 @r###"
280 [ 277 [
281 CompletionItem { 278 CompletionItem {
282 label: "main()", 279 label: "main()",
283 source_range: [61; 64), 280 source_range: [61; 64),
284 delete: [61; 64), 281 delete: [61; 64),
285 insert: "main()$0", 282 insert: "main()$0",
@@ -288,7 +285,7 @@ mod tests {
288 detail: "fn main()", 285 detail: "fn main()",
289 }, 286 },
290 CompletionItem { 287 CompletionItem {
291 label: "no_args()", 288 label: "no_args()",
292 source_range: [61; 64), 289 source_range: [61; 64),
293 delete: [61; 64), 290 delete: [61; 64),
294 insert: "no_args()$0", 291 insert: "no_args()$0",
@@ -309,7 +306,7 @@ mod tests {
309 @r###" 306 @r###"
310 [ 307 [
311 CompletionItem { 308 CompletionItem {
312 label: "main()", 309 label: "main()",
313 source_range: [80; 85), 310 source_range: [80; 85),
314 delete: [80; 85), 311 delete: [80; 85),
315 insert: "main()$0", 312 insert: "main()$0",
@@ -344,7 +341,7 @@ mod tests {
344 @r###" 341 @r###"
345 [ 342 [
346 CompletionItem { 343 CompletionItem {
347 label: "foo()", 344 label: "foo()",
348 source_range: [163; 164), 345 source_range: [163; 164),
349 delete: [163; 164), 346 delete: [163; 164),
350 insert: "foo()$0", 347 insert: "foo()$0",