@@ -670,7 +670,8 @@ struct InlayHintLabelBuilder<'a> {
670
670
db : & ' a RootDatabase ,
671
671
result : InlayHintLabel ,
672
672
last_part : String ,
673
- resolve : bool ,
673
+ resolve_location : bool ,
674
+ resolve_tooltip : bool ,
674
675
location : Option < LazyProperty < FileRange > > ,
675
676
tooltip : Option < LazyProperty < InlayTooltip > > ,
676
677
in_truncated_part : bool ,
@@ -691,7 +692,7 @@ impl HirWrite for InlayHintLabelBuilder<'_> {
691
692
never ! ( self . location. is_some( ) , "location link is already started" ) ;
692
693
self . make_new_part ( ) ;
693
694
694
- self . location = Some ( if self . resolve {
695
+ self . location = Some ( if self . resolve_location {
695
696
LazyProperty :: Lazy
696
697
} else {
697
698
LazyProperty :: Computed ( {
@@ -709,6 +710,8 @@ impl HirWrite for InlayHintLabelBuilder<'_> {
709
710
self . make_new_part ( ) ;
710
711
}
711
712
713
+ /// Returns whether a new truncated part is created during this call. If not, it indicates that
714
+ /// the last part is a truncated part.
712
715
fn start_truncated ( & mut self ) -> bool {
713
716
never ! ( self . location. is_some( ) , "location link is already started" ) ;
714
717
// If currently in the truncated part, do not create a new part and continue writing into
@@ -727,7 +730,7 @@ impl HirWrite for InlayHintLabelBuilder<'_> {
727
730
always ! ( self . in_truncated_part, "truncated is not started" ) ;
728
731
729
732
const HINT_TRUNCATION : & str = "…" ;
730
- if self . resolve {
733
+ if self . resolve_tooltip {
731
734
self . last_part = HINT_TRUNCATION . to_owned ( ) ;
732
735
self . tooltip = Some ( LazyProperty :: Lazy ) ;
733
736
} else {
@@ -821,7 +824,8 @@ fn label_of_ty(
821
824
tooltip : None ,
822
825
in_truncated_part : false ,
823
826
result : InlayHintLabel :: default ( ) ,
824
- resolve : config. fields_to_resolve . resolve_label_location ,
827
+ resolve_location : config. fields_to_resolve . resolve_label_location ,
828
+ resolve_tooltip : config. fields_to_resolve . resolve_label_tooltip ,
825
829
} ;
826
830
let _ =
827
831
rec ( sema, famous_defs, config. max_length , ty, & mut label_builder, config, display_target) ;
@@ -945,15 +949,8 @@ mod tests {
945
949
lifetime_elision_hints : LifetimeElisionHints :: Always ,
946
950
..DISABLED_CONFIG
947
951
} ;
948
- pub ( super ) const TEST_CONFIG_WITH_TRUNCATION : InlayHintsConfig = InlayHintsConfig {
949
- type_hints : true ,
950
- parameter_hints : true ,
951
- chaining_hints : true ,
952
- closure_return_type_hints : ClosureReturnTypeHints :: WithBlock ,
953
- binding_mode_hints : true ,
954
- max_length : Some ( 10 ) ,
955
- ..DISABLED_CONFIG
956
- } ;
952
+ pub ( super ) const TEST_CONFIG_WITH_TRUNCATION : InlayHintsConfig =
953
+ InlayHintsConfig { max_length : Some ( 10 ) , ..TEST_CONFIG } ;
957
954
958
955
#[ track_caller]
959
956
pub ( super ) fn check ( #[ rust_analyzer:: rust_fixture] ra_fixture : & str ) {
0 commit comments