@@ -55,38 +55,32 @@ pub struct InlayHintsConfig {
5555 pub fields_to_resolve : InlayFieldsToResolve ,
5656}
5757
58- #[ derive( Clone , Debug , PartialEq , Eq ) ]
58+ #[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
5959pub struct InlayFieldsToResolve {
60- pub client_capability_fields : Vec < String > ,
60+ pub resolve_text_edits : bool ,
61+ pub resolve_hint_tooltip : bool ,
62+ pub resolve_label_tooltip : bool ,
63+ pub resolve_label_location : bool ,
64+ pub resolve_label_command : bool ,
6165}
6266
6367impl InlayFieldsToResolve {
6468 pub const fn empty ( ) -> Self {
65- Self { client_capability_fields : Vec :: new ( ) }
66- }
67-
68- pub fn is_empty ( & self ) -> bool {
69- self . client_capability_fields . is_empty ( )
70- }
71-
72- pub fn resolve_text_edits ( & self ) -> bool {
73- self . client_capability_fields . iter ( ) . find ( |s| s. as_str ( ) == "textEdits" ) . is_some ( )
74- }
75-
76- pub fn resolve_hint_tooltip ( & self ) -> bool {
77- self . client_capability_fields . iter ( ) . find ( |s| s. as_str ( ) == "tooltip" ) . is_some ( )
78- }
79-
80- pub fn resolve_label_tooltip ( & self ) -> bool {
81- self . client_capability_fields . iter ( ) . find ( |s| s. as_str ( ) == "label.tooltip" ) . is_some ( )
82- }
83-
84- pub fn resolve_label_location ( & self ) -> bool {
85- self . client_capability_fields . iter ( ) . find ( |s| s. as_str ( ) == "label.location" ) . is_some ( )
69+ Self {
70+ resolve_text_edits : false ,
71+ resolve_hint_tooltip : false ,
72+ resolve_label_tooltip : false ,
73+ resolve_label_location : false ,
74+ resolve_label_command : false ,
75+ }
8676 }
8777
88- pub fn resolve_label_command ( & self ) -> bool {
89- self . client_capability_fields . iter ( ) . find ( |s| s. as_str ( ) == "label.command" ) . is_some ( )
78+ pub fn can_resolve ( & self ) -> bool {
79+ self . resolve_text_edits
80+ || self . resolve_hint_tooltip
81+ || self . resolve_label_tooltip
82+ || self . resolve_label_location
83+ || self . resolve_label_command
9084 }
9185}
9286
@@ -605,19 +599,7 @@ mod tests {
605599 closure_return_type_hints : ClosureReturnTypeHints :: WithBlock ,
606600 binding_mode_hints : true ,
607601 lifetime_elision_hints : LifetimeElisionHints :: Always ,
608- discriminant_hints : DiscriminantHints :: Never ,
609- render_colons : false ,
610- closure_capture_hints : false ,
611- adjustment_hints : AdjustmentHints :: Never ,
612- adjustment_hints_mode : AdjustmentHintsMode :: Prefix ,
613- adjustment_hints_hide_outside_unsafe : false ,
614- hide_named_constructor_hints : false ,
615- hide_closure_initialization_hints : false ,
616- closure_style : ClosureStyle :: ImplFn ,
617- param_names_for_lifetime_elision_hints : false ,
618- max_length : None ,
619- closing_brace_hints_min_lines : None ,
620- fields_to_resolve : InlayFieldsToResolve :: empty ( ) ,
602+ ..DISABLED_CONFIG
621603 } ;
622604
623605 #[ track_caller]
0 commit comments