@@ -182,13 +182,26 @@ fn check_hover_no_markdown(ra_fixture: &str, expect: Expect) {
182
182
183
183
fn check_actions ( ra_fixture : & str , expect : Expect ) {
184
184
let ( analysis, file_id, position) = fixture:: range_or_position ( ra_fixture) ;
185
- let hover = analysis
185
+ let mut hover = analysis
186
186
. hover (
187
187
& HoverConfig { links_in_hover : true , ..HOVER_BASE_CONFIG } ,
188
188
FileRange { file_id, range : position. range_or_empty ( ) } ,
189
189
)
190
190
. unwrap ( )
191
191
. unwrap ( ) ;
192
+ // stub out ranges into minicore as they can change every now and then
193
+ hover. info . actions . iter_mut ( ) . for_each ( |action| match action {
194
+ super :: HoverAction :: GoToType ( act) => act. iter_mut ( ) . for_each ( |data| {
195
+ if data. nav . file_id == file_id {
196
+ return ;
197
+ }
198
+ data. nav . full_range = TextRange :: empty ( span:: TextSize :: new ( !0 ) ) ;
199
+ if let Some ( range) = & mut data. nav . focus_range {
200
+ * range = TextRange :: empty ( span:: TextSize :: new ( !0 ) ) ;
201
+ }
202
+ } ) ,
203
+ _ => ( ) ,
204
+ } ) ;
192
205
expect. assert_debug_eq ( & hover. info . actions )
193
206
}
194
207
@@ -200,10 +213,23 @@ fn check_hover_range(ra_fixture: &str, expect: Expect) {
200
213
201
214
fn check_hover_range_actions ( ra_fixture : & str , expect : Expect ) {
202
215
let ( analysis, range) = fixture:: range ( ra_fixture) ;
203
- let hover = analysis
216
+ let mut hover = analysis
204
217
. hover ( & HoverConfig { links_in_hover : true , ..HOVER_BASE_CONFIG } , range)
205
218
. unwrap ( )
206
219
. unwrap ( ) ;
220
+ // stub out ranges into minicore as they can change every now and then
221
+ hover. info . actions . iter_mut ( ) . for_each ( |action| match action {
222
+ super :: HoverAction :: GoToType ( act) => act. iter_mut ( ) . for_each ( |data| {
223
+ if data. nav . file_id == range. file_id {
224
+ return ;
225
+ }
226
+ data. nav . full_range = TextRange :: empty ( span:: TextSize :: new ( !0 ) ) ;
227
+ if let Some ( range) = & mut data. nav . focus_range {
228
+ * range = TextRange :: empty ( span:: TextSize :: new ( !0 ) ) ;
229
+ }
230
+ } ) ,
231
+ _ => ( ) ,
232
+ } ) ;
207
233
expect. assert_debug_eq ( & hover. info . actions ) ;
208
234
}
209
235
@@ -483,8 +509,8 @@ fn main() {
483
509
file_id: FileId(
484
510
1,
485
511
),
486
- full_range: 632..867 ,
487
- focus_range: 693..699 ,
512
+ full_range: 4294967295..4294967295 ,
513
+ focus_range: 4294967295..4294967295 ,
488
514
name: "FnOnce",
489
515
kind: Trait,
490
516
container_name: "function",
@@ -3104,26 +3130,26 @@ struct S{ f1: u32 }
3104
3130
fn main() { let s$0t = S{ f1:0 }; }
3105
3131
"# ,
3106
3132
expect ! [ [ r#"
3107
- [
3108
- GoToType(
3109
- [
3110
- HoverGotoTypeData {
3111
- mod_path: "test::S",
3112
- nav: NavigationTarget {
3113
- file_id: FileId(
3114
- 0,
3115
- ),
3116
- full_range: 0..19,
3117
- focus_range: 7..8,
3118
- name: "S",
3119
- kind: Struct,
3120
- description: "struct S",
3121
- },
3133
+ [
3134
+ GoToType(
3135
+ [
3136
+ HoverGotoTypeData {
3137
+ mod_path: "test::S",
3138
+ nav: NavigationTarget {
3139
+ file_id: FileId(
3140
+ 0,
3141
+ ),
3142
+ full_range: 0..19,
3143
+ focus_range: 7..8,
3144
+ name: "S",
3145
+ kind: Struct,
3146
+ description: "struct S",
3122
3147
},
3123
- ],
3124
- ),
3125
- ]
3126
- "# ] ] ,
3148
+ },
3149
+ ],
3150
+ ),
3151
+ ]
3152
+ "# ] ] ,
3127
3153
) ;
3128
3154
}
3129
3155
@@ -3616,8 +3642,8 @@ pub mod future {
3616
3642
file_id: FileId(
3617
3643
1,
3618
3644
),
3619
- full_range: 21..69 ,
3620
- focus_range: 60..66 ,
3645
+ full_range: 4294967295..4294967295 ,
3646
+ focus_range: 4294967295..4294967295 ,
3621
3647
name: "Future",
3622
3648
kind: Trait,
3623
3649
container_name: "future",
@@ -8465,8 +8491,8 @@ impl Iterator for S {
8465
8491
file_id: FileId(
8466
8492
1,
8467
8493
),
8468
- full_range: 7800..8008 ,
8469
- focus_range: 7865..7871 ,
8494
+ full_range: 4294967295..4294967295 ,
8495
+ focus_range: 4294967295..4294967295 ,
8470
8496
name: "Future",
8471
8497
kind: Trait,
8472
8498
container_name: "future",
@@ -8479,8 +8505,8 @@ impl Iterator for S {
8479
8505
file_id: FileId(
8480
8506
1,
8481
8507
),
8482
- full_range: 8638..9104 ,
8483
- focus_range: 8682..8690 ,
8508
+ full_range: 4294967295..4294967295 ,
8509
+ focus_range: 4294967295..4294967295 ,
8484
8510
name: "Iterator",
8485
8511
kind: Trait,
8486
8512
container_name: "iterator",
0 commit comments