diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-10 17:56:44 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-10 17:56:44 +0000 |
commit | e5df8c402847d5bedb8ebcb621aac46dbe215cdd (patch) | |
tree | 87f12e2619ac0074134b758ddcc1f6c1ccef863a /crates/ra_ide/src/completion/presentation.rs | |
parent | daf3609654b6e9b2ac2808a056c61438674a1dc9 (diff) | |
parent | 14094e44770559c13a1e8bdfcfb989d3bedd00d8 (diff) |
Merge #3551
3551: Move FeatureFlags r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/completion/presentation.rs')
-rw-r--r-- | crates/ra_ide/src/completion/presentation.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index aada4d025..3dc56e4a3 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs | |||
@@ -104,10 +104,7 @@ impl Completions { | |||
104 | }; | 104 | }; |
105 | 105 | ||
106 | // Add `<>` for generic types | 106 | // Add `<>` for generic types |
107 | if ctx.is_path_type | 107 | if ctx.is_path_type && !ctx.has_type_args && ctx.options.add_call_parenthesis { |
108 | && !ctx.has_type_args | ||
109 | && ctx.db.feature_flags.get("completion.insertion.add-call-parenthesis") | ||
110 | { | ||
111 | let has_non_default_type_params = match resolution { | 108 | let has_non_default_type_params = match resolution { |
112 | ScopeDef::ModuleDef(Adt(it)) => it.has_non_default_type_params(ctx.db), | 109 | ScopeDef::ModuleDef(Adt(it)) => it.has_non_default_type_params(ctx.db), |
113 | ScopeDef::ModuleDef(TypeAlias(it)) => it.has_non_default_type_params(ctx.db), | 110 | ScopeDef::ModuleDef(TypeAlias(it)) => it.has_non_default_type_params(ctx.db), |
@@ -212,21 +209,14 @@ impl Completions { | |||
212 | .detail(function_signature.to_string()); | 209 | .detail(function_signature.to_string()); |
213 | 210 | ||
214 | // If not an import, add parenthesis automatically. | 211 | // If not an import, add parenthesis automatically. |
215 | if ctx.use_item_syntax.is_none() | 212 | 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); | 213 | tested_by!(inserts_parens_for_function_calls); |
220 | 214 | ||
221 | let (snippet, label) = if params.is_empty() || has_self_param && params.len() == 1 { | 215 | let (snippet, label) = if params.is_empty() || has_self_param && params.len() == 1 { |
222 | (format!("{}()$0", name), format!("{}()", name)) | 216 | (format!("{}()$0", name), format!("{}()", name)) |
223 | } else { | 217 | } else { |
224 | builder = builder.trigger_call_info(); | 218 | builder = builder.trigger_call_info(); |
225 | let snippet = if ctx | 219 | 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 }; | 220 | let to_skip = if has_self_param { 1 } else { 0 }; |
231 | let function_params_snippet = join( | 221 | let function_params_snippet = join( |
232 | function_signature.parameter_names.iter().skip(to_skip).enumerate().map( | 222 | function_signature.parameter_names.iter().skip(to_skip).enumerate().map( |