@@ -20,16 +20,17 @@ use text_edit::TextEdit;
2020
2121use crate :: { navigation_target:: TryToNav , FileId } ;
2222
23- mod closing_brace;
24- mod implicit_static;
25- mod fn_lifetime_fn;
26- mod closure_ret;
2723mod adjustment;
28- mod chaining;
29- mod param_name;
30- mod binding_mode;
3124mod bind_pat;
25+ mod binding_mode;
26+ mod chaining;
27+ mod closing_brace;
28+ mod closure_ret;
29+ mod closure_captures;
3230mod discriminant;
31+ mod fn_lifetime_fn;
32+ mod implicit_static;
33+ mod param_name;
3334
3435#[ derive( Clone , Debug , PartialEq , Eq ) ]
3536pub struct InlayHintsConfig {
@@ -42,6 +43,7 @@ pub struct InlayHintsConfig {
4243 pub adjustment_hints_mode : AdjustmentHintsMode ,
4344 pub adjustment_hints_hide_outside_unsafe : bool ,
4445 pub closure_return_type_hints : ClosureReturnTypeHints ,
46+ pub closure_capture_hints : bool ,
4547 pub binding_mode_hints : bool ,
4648 pub lifetime_elision_hints : LifetimeElisionHints ,
4749 pub param_names_for_lifetime_elision_hints : bool ,
@@ -88,6 +90,8 @@ pub enum AdjustmentHintsMode {
8890 PreferPostfix ,
8991}
9092
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.
9195#[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
9296pub enum InlayKind {
9397 BindingMode ,
@@ -98,6 +102,7 @@ pub enum InlayKind {
98102 Adjustment ,
99103 AdjustmentPostfix ,
100104 Lifetime ,
105+ ClosureCapture ,
101106 Parameter ,
102107 Type ,
103108 Discriminant ,
@@ -444,10 +449,10 @@ fn hints(
444449 ast:: Expr :: MethodCallExpr ( it) => {
445450 param_name:: hints( hints, sema, config, ast:: Expr :: from( it) )
446451 }
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+ } ,
451456 _ => None ,
452457 }
453458 } ,
@@ -535,6 +540,7 @@ mod tests {
535540 chaining_hints : false ,
536541 lifetime_elision_hints : LifetimeElisionHints :: Never ,
537542 closure_return_type_hints : ClosureReturnTypeHints :: Never ,
543+ closure_capture_hints : false ,
538544 adjustment_hints : AdjustmentHints :: Never ,
539545 adjustment_hints_mode : AdjustmentHintsMode :: Prefix ,
540546 adjustment_hints_hide_outside_unsafe : false ,
0 commit comments