diff options
author | Aleksey Kladov <[email protected]> | 2020-03-10 17:39:17 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-03-10 17:40:22 +0000 |
commit | 2347c03dcd717fbc0648c1e4e3d64a886217de5d (patch) | |
tree | c778877ddc5e17ee7adca15324fe3f5a417f062a /crates/ra_ide/src/completion/presentation.rs | |
parent | 6b9d66bbee865bd4337366f1540f8e5aa8d82c18 (diff) |
Introduce CompletionOptions
Diffstat (limited to 'crates/ra_ide/src/completion/presentation.rs')
-rw-r--r-- | crates/ra_ide/src/completion/presentation.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index aada4d025..25aff329e 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs | |||
@@ -212,21 +212,14 @@ impl Completions { | |||
212 | .detail(function_signature.to_string()); | 212 | .detail(function_signature.to_string()); |
213 | 213 | ||
214 | // If not an import, add parenthesis automatically. | 214 | // If not an import, add parenthesis automatically. |
215 | if ctx.use_item_syntax.is_none() | 215 | if ctx.use_item_syntax.is_none() && !ctx.is_call && ctx.options.add_call_parenthesis { |
216 | && !ctx.is_call | ||
217 | && ctx.db.feature_flags.get("completion.insertion.add-call-parenthesis") | ||
218 | { | ||
219 | tested_by!(inserts_parens_for_function_calls); | 216 | tested_by!(inserts_parens_for_function_calls); |
220 | 217 | ||
221 | let (snippet, label) = if params.is_empty() || has_self_param && params.len() == 1 { | 218 | let (snippet, label) = if params.is_empty() || has_self_param && params.len() == 1 { |
222 | (format!("{}()$0", name), format!("{}()", name)) | 219 | (format!("{}()$0", name), format!("{}()", name)) |
223 | } else { | 220 | } else { |
224 | builder = builder.trigger_call_info(); | 221 | builder = builder.trigger_call_info(); |
225 | let snippet = if ctx | 222 | let snippet = if ctx.options.add_call_argument_snippets { |
226 | .db | ||
227 | .feature_flags | ||
228 | .get("completion.insertion.add-argument-snippets") | ||
229 | { | ||
230 | let to_skip = if has_self_param { 1 } else { 0 }; | 223 | let to_skip = if has_self_param { 1 } else { 0 }; |
231 | let function_params_snippet = join( | 224 | let function_params_snippet = join( |
232 | function_signature.parameter_names.iter().skip(to_skip).enumerate().map( | 225 | function_signature.parameter_names.iter().skip(to_skip).enumerate().map( |