@@ -20,16 +20,17 @@ use text_edit::TextEdit;
20
20
21
21
use crate :: { navigation_target:: TryToNav , FileId } ;
22
22
23
- mod closing_brace;
24
- mod implicit_static;
25
- mod fn_lifetime_fn;
26
- mod closure_ret;
27
23
mod adjustment;
28
- mod chaining;
29
- mod param_name;
30
- mod binding_mode;
31
24
mod bind_pat;
25
+ mod binding_mode;
26
+ mod chaining;
27
+ mod closing_brace;
28
+ mod closure_ret;
29
+ mod closure_captures;
32
30
mod discriminant;
31
+ mod fn_lifetime_fn;
32
+ mod implicit_static;
33
+ mod param_name;
33
34
34
35
#[ derive( Clone , Debug , PartialEq , Eq ) ]
35
36
pub struct InlayHintsConfig {
@@ -42,6 +43,7 @@ pub struct InlayHintsConfig {
42
43
pub adjustment_hints_mode : AdjustmentHintsMode ,
43
44
pub adjustment_hints_hide_outside_unsafe : bool ,
44
45
pub closure_return_type_hints : ClosureReturnTypeHints ,
46
+ pub closure_capture_hints : bool ,
45
47
pub binding_mode_hints : bool ,
46
48
pub lifetime_elision_hints : LifetimeElisionHints ,
47
49
pub param_names_for_lifetime_elision_hints : bool ,
@@ -88,6 +90,8 @@ pub enum AdjustmentHintsMode {
88
90
PreferPostfix ,
89
91
}
90
92
93
+ // FIXME: Clean up this mess, the kinds are mainly used for setting different rendering properties in the lsp layer
94
+ // We should probably turns this into such a property holding struct. Or clean this up in some other form.
91
95
#[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
92
96
pub enum InlayKind {
93
97
BindingMode ,
@@ -98,6 +102,7 @@ pub enum InlayKind {
98
102
Adjustment ,
99
103
AdjustmentPostfix ,
100
104
Lifetime ,
105
+ ClosureCapture ,
101
106
Parameter ,
102
107
Type ,
103
108
Discriminant ,
@@ -444,10 +449,10 @@ fn hints(
444
449
ast:: Expr :: MethodCallExpr ( it) => {
445
450
param_name:: hints( hints, sema, config, ast:: Expr :: from( it) )
446
451
}
447
- ast:: Expr :: ClosureExpr ( it) => closure_ret :: hints ( hints , famous_defs , config , file_id , it ) ,
448
- // We could show reborrows for all expressions, but usually that is just noise to the user
449
- // and the main point here is to show why "moving" a mutable reference doesn't necessarily move it
450
- // ast::Expr::PathExpr(_) => reborrow_hints(hints, sema, config, &expr) ,
452
+ ast:: Expr :: ClosureExpr ( it) => {
453
+ closure_captures :: hints ( hints , famous_defs , config , file_id , it . clone ( ) ) ;
454
+ closure_ret :: hints ( hints , famous_defs , config , file_id , it )
455
+ } ,
451
456
_ => None ,
452
457
}
453
458
} ,
@@ -535,6 +540,7 @@ mod tests {
535
540
chaining_hints : false ,
536
541
lifetime_elision_hints : LifetimeElisionHints :: Never ,
537
542
closure_return_type_hints : ClosureReturnTypeHints :: Never ,
543
+ closure_capture_hints : false ,
538
544
adjustment_hints : AdjustmentHints :: Never ,
539
545
adjustment_hints_mode : AdjustmentHintsMode :: Prefix ,
540
546
adjustment_hints_hide_outside_unsafe : false ,
0 commit comments