full function signatures option
This commit is contained in:
parent
c405509f2e
commit
23ffda1a97
@ -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,
|
||||
|
@ -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();
|
||||
|
||||
|
@ -215,6 +215,8 @@ struct ConfigData {
|
||||
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 @@ pub fn completion(&self) -> CompletionConfig {
|
||||
&& 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),
|
||||
|
Loading…
Reference in New Issue
Block a user