@@ -98,9 +98,14 @@ fn render(
98
98
_ => ( ) ,
99
99
}
100
100
101
+ let detail = if ctx. completion . config . full_function_signatures {
102
+ detail_full ( db, func)
103
+ } else {
104
+ detail ( db, func)
105
+ } ;
101
106
item. set_documentation ( ctx. docs ( func) )
102
107
. set_deprecated ( ctx. is_deprecated ( func) || ctx. is_deprecated_assoc_item ( func) )
103
- . detail ( detail ( db , func , ctx . completion . config . full_function_signatures ) )
108
+ . detail ( detail)
104
109
. lookup_by ( name. unescaped ( ) . to_smol_str ( ) ) ;
105
110
106
111
match ctx. completion . config . snippet_cap {
@@ -239,22 +244,7 @@ fn ref_of_param(ctx: &CompletionContext<'_>, arg: &str, ty: &hir::Type) -> &'sta
239
244
""
240
245
}
241
246
242
- fn detail ( db : & dyn HirDatabase , func : hir:: Function , full_function_signature : bool ) -> String {
243
- if full_function_signature {
244
- let signature = format ! ( "{}" , func. display( db) ) ;
245
- let mut singleline = String :: with_capacity ( signature. len ( ) ) ;
246
-
247
- for segment in signature. split_whitespace ( ) {
248
- if !singleline. is_empty ( ) {
249
- singleline. push ( ' ' ) ;
250
- }
251
-
252
- singleline. push_str ( segment) ;
253
- }
254
-
255
- return singleline;
256
- }
257
-
247
+ fn detail ( db : & dyn HirDatabase , func : hir:: Function ) -> String {
258
248
let mut ret_ty = func. ret_type ( db) ;
259
249
let mut detail = String :: new ( ) ;
260
250
@@ -278,6 +268,21 @@ fn detail(db: &dyn HirDatabase, func: hir::Function, full_function_signature: bo
278
268
detail
279
269
}
280
270
271
+ fn detail_full ( db : & dyn HirDatabase , func : hir:: Function ) -> String {
272
+ let signature = format ! ( "{}" , func. display( db) ) ;
273
+ let mut detail = String :: with_capacity ( signature. len ( ) ) ;
274
+
275
+ for segment in signature. split_whitespace ( ) {
276
+ if !detail. is_empty ( ) {
277
+ detail. push ( ' ' ) ;
278
+ }
279
+
280
+ detail. push_str ( segment) ;
281
+ }
282
+
283
+ detail
284
+ }
285
+
281
286
fn params_display ( db : & dyn HirDatabase , func : hir:: Function ) -> String {
282
287
if let Some ( self_param) = func. self_param ( db) {
283
288
let assoc_fn_params = func. assoc_fn_params ( db) ;
0 commit comments