diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2022-05-13 19:52:44 +0200 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2022-05-13 19:52:44 +0200 |
| commit | 3577c44dee95f0b2b5367dd034f5188317be08eb (patch) | |
| tree | 0f1211aaa90526b7d486fab7046246a3d1830020 /crates/ide-completion/src/render | |
| parent | 4f6b2a20fd0417c6c1c64163d9ce7a5c915afde1 (diff) | |
| download | rust-3577c44dee95f0b2b5367dd034f5188317be08eb.tar.gz rust-3577c44dee95f0b2b5367dd034f5188317be08eb.zip | |
fix: Fix fill-arguments completions not working
Diffstat (limited to 'crates/ide-completion/src/render')
| -rw-r--r-- | crates/ide-completion/src/render/function.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ide-completion/src/render/function.rs b/crates/ide-completion/src/render/function.rs index 1ede314e87b..c47696bc41d 100644 --- a/crates/ide-completion/src/render/function.rs +++ b/crates/ide-completion/src/render/function.rs @@ -10,6 +10,7 @@ use crate::{ context::{CompletionContext, DotAccess, NameRefContext, PathCompletionCtx, PathKind}, item::{Builder, CompletionItem, CompletionItemKind, CompletionRelevance}, render::{compute_exact_name_match, compute_ref_match, compute_type_match, RenderContext}, + CallableSnippets, }; enum FuncKind { @@ -123,7 +124,7 @@ pub(super) fn add_call_parens<'b>( (format!("{}()$0", name), "()") } else { builder.trigger_call_info(); - let snippet = if ctx.config.add_call_argument_snippets { + let snippet = if let Some(CallableSnippets::FillArguments) = ctx.config.callable { let offset = if self_param.is_some() { 2 } else { 1 }; let function_params_snippet = params.iter().enumerate().format_with(", ", |(index, param), f| { @@ -191,7 +192,7 @@ fn ref_of_param(ctx: &CompletionContext, arg: &str, ty: &hir::Type) -> &'static } fn should_add_parens(ctx: &CompletionContext) -> bool { - if !ctx.config.add_call_parenthesis { + if ctx.config.callable.is_none() { return false; } @@ -288,7 +289,7 @@ fn params( mod tests { use crate::{ tests::{check_edit, check_edit_with_config, TEST_CONFIG}, - CompletionConfig, + CallableSnippets, CompletionConfig, }; #[test] @@ -404,7 +405,7 @@ fn main() { S::foo(${1:&self})$0 } fn suppress_arg_snippets() { cov_mark::check!(suppress_arg_snippets); check_edit_with_config( - CompletionConfig { add_call_argument_snippets: false, ..TEST_CONFIG }, + CompletionConfig { callable: Some(CallableSnippets::AddParentheses), ..TEST_CONFIG }, "with_args", r#" fn with_args(x: i32, y: String) {} |
