Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/ide-completion/src/config.rs1
-rw-r--r--crates/ide-completion/src/render/function.rs8
-rw-r--r--crates/rust-analyzer/src/config.rs3
3 files changed, 10 insertions, 2 deletions
diff --git a/crates/ide-completion/src/config.rs b/crates/ide-completion/src/config.rs
index 8f6a97e1e0..3d025f284b 100644
--- a/crates/ide-completion/src/config.rs
+++ b/crates/ide-completion/src/config.rs
@@ -14,6 +14,7 @@ pub struct CompletionConfig {
pub enable_imports_on_the_fly: bool,
pub enable_self_on_the_fly: bool,
pub enable_private_editable: bool,
+ pub full_function_signatures: bool,
pub callable: Option<CallableSnippets>,
pub snippet_cap: Option<SnippetCap>,
pub insert_use: InsertUseConfig,
diff --git a/crates/ide-completion/src/render/function.rs b/crates/ide-completion/src/render/function.rs
index 8afce8db5e..1672826f33 100644
--- a/crates/ide-completion/src/render/function.rs
+++ b/crates/ide-completion/src/render/function.rs
@@ -100,7 +100,7 @@ fn render(
item.set_documentation(ctx.docs(func))
.set_deprecated(ctx.is_deprecated(func) || ctx.is_deprecated_assoc_item(func))
- .detail(detail(db, func))
+ .detail(detail(db, func, ctx.completion.config.full_function_signatures))
.lookup_by(name.unescaped().to_smol_str());
match ctx.completion.config.snippet_cap {
@@ -239,7 +239,11 @@ fn ref_of_param(ctx: &CompletionContext<'_>, arg: &str, ty: &hir::Type) -> &'sta
""
}
-fn detail(db: &dyn HirDatabase, func: hir::Function) -> String {
+fn detail(db: &dyn HirDatabase, func: hir::Function, full_function_signature: bool) -> String {
+ if full_function_signature {
+ return format!("{}", func.display(db)).replace("\n", " ");
+ }
+
let mut ret_ty = func.ret_type(db);
let mut detail = String::new();
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index ea3a21241c..07c6457b9c 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -215,6 +215,8 @@ config_data! {
completion_postfix_enable: bool = "true",
/// Enables completions of private items and fields that are defined in the current workspace even if they are not visible at the current position.
completion_privateEditable_enable: bool = "false",
+ /// Whether to show full function/method signatures in completion docs.
+ completion_fullFunctionSignatures_enable: bool = "false",
/// Custom completion snippets.
// NOTE: Keep this list in sync with the feature docs of user snippets.
completion_snippets_custom: FxHashMap<String, SnippetDef> = r#"{
@@ -1444,6 +1446,7 @@ impl Config {
&& completion_item_edit_resolve(&self.caps),
enable_self_on_the_fly: self.data.completion_autoself_enable,
enable_private_editable: self.data.completion_privateEditable_enable,
+ full_function_signatures: self.data.completion_fullFunctionSignatures_enable,
callable: match self.data.completion_callable_snippets {
CallableCompletionDef::FillArguments => Some(CallableSnippets::FillArguments),
CallableCompletionDef::AddParentheses => Some(CallableSnippets::AddParentheses),