aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r--crates/ra_ide/src/completion/presentation.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index e623c47ec..841d36c8f 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -221,16 +221,25 @@ impl Completions {
221 let (snippet, label) = if params.is_empty() || has_self_param && params.len() == 1 { 221 let (snippet, label) = if params.is_empty() || has_self_param && params.len() == 1 {
222 (format!("{}()$0", name), format!("{}()", name)) 222 (format!("{}()$0", name), format!("{}()", name))
223 } else { 223 } else {
224 let to_skip = if has_self_param { 1 } else { 0 }; 224 let snippet = if ctx
225 let function_params_snippet = 225 .db
226 join( 226 .feature_flags
227 .get("completion.insertion.add-argument-sippets")
228 {
229 let to_skip = if has_self_param { 1 } else { 0 };
230 let function_params_snippet = join(
227 function_signature.parameter_names.iter().skip(to_skip).enumerate().map( 231 function_signature.parameter_names.iter().skip(to_skip).enumerate().map(
228 |(index, param_name)| format!("${{{}:{}}}", index + 1, param_name), 232 |(index, param_name)| format!("${{{}:{}}}", index + 1, param_name),
229 ), 233 ),
230 ) 234 )
231 .separator(", ") 235 .separator(", ")
232 .to_string(); 236 .to_string();
233 (format!("{}({})$0", name, function_params_snippet), format!("{}(…)", name)) 237 format!("{}({})$0", name, function_params_snippet)
238 } else {
239 format!("{}($0)", name)
240 };
241
242 (snippet, format!("{}(…)", name))
234 }; 243 };
235 builder = builder.lookup_by(name).label(label).insert_snippet(snippet); 244 builder = builder.lookup_by(name).label(label).insert_snippet(snippet);
236 } 245 }