@@ -1358,17 +1358,18 @@ pub(crate) fn code_lens(
1358
1358
} )
1359
1359
}
1360
1360
}
1361
- AnnotationKind :: HasImpls { pos : file_range , data } => {
1361
+ AnnotationKind :: HasImpls { pos, data } => {
1362
1362
if !client_commands_config. show_reference {
1363
1363
return Ok ( ( ) ) ;
1364
1364
}
1365
- let line_index = snap. file_line_index ( file_range . file_id ) ?;
1365
+ let line_index = snap. file_line_index ( pos . file_id ) ?;
1366
1366
let annotation_range = range ( & line_index, annotation. range ) ;
1367
- let url = url ( snap, file_range. file_id ) ;
1367
+ let url = url ( snap, pos. file_id ) ;
1368
+ let pos = position ( & line_index, pos. offset ) ;
1368
1369
1369
1370
let id = lsp_types:: TextDocumentIdentifier { uri : url. clone ( ) } ;
1370
1371
1371
- let doc_pos = lsp_types:: TextDocumentPositionParams :: new ( id, annotation_range . start ) ;
1372
+ let doc_pos = lsp_types:: TextDocumentPositionParams :: new ( id, pos ) ;
1372
1373
1373
1374
let goto_params = lsp_types:: request:: GotoImplementationParams {
1374
1375
text_document_position_params : doc_pos,
@@ -1391,7 +1392,7 @@ pub(crate) fn code_lens(
1391
1392
command:: show_references (
1392
1393
implementation_title ( locations. len ( ) ) ,
1393
1394
& url,
1394
- annotation_range . start ,
1395
+ pos ,
1395
1396
locations,
1396
1397
)
1397
1398
} ) ;
@@ -1411,28 +1412,24 @@ pub(crate) fn code_lens(
1411
1412
} ) ( ) ,
1412
1413
} )
1413
1414
}
1414
- AnnotationKind :: HasReferences { pos : file_range , data } => {
1415
+ AnnotationKind :: HasReferences { pos, data } => {
1415
1416
if !client_commands_config. show_reference {
1416
1417
return Ok ( ( ) ) ;
1417
1418
}
1418
- let line_index = snap. file_line_index ( file_range . file_id ) ?;
1419
+ let line_index = snap. file_line_index ( pos . file_id ) ?;
1419
1420
let annotation_range = range ( & line_index, annotation. range ) ;
1420
- let url = url ( snap, file_range. file_id ) ;
1421
+ let url = url ( snap, pos. file_id ) ;
1422
+ let pos = position ( & line_index, pos. offset ) ;
1421
1423
1422
1424
let id = lsp_types:: TextDocumentIdentifier { uri : url. clone ( ) } ;
1423
1425
1424
- let doc_pos = lsp_types:: TextDocumentPositionParams :: new ( id, annotation_range . start ) ;
1426
+ let doc_pos = lsp_types:: TextDocumentPositionParams :: new ( id, pos ) ;
1425
1427
1426
1428
let command = data. map ( |ranges| {
1427
1429
let locations: Vec < lsp_types:: Location > =
1428
1430
ranges. into_iter ( ) . filter_map ( |range| location ( snap, range) . ok ( ) ) . collect ( ) ;
1429
1431
1430
- command:: show_references (
1431
- reference_title ( locations. len ( ) ) ,
1432
- & url,
1433
- annotation_range. start ,
1434
- locations,
1435
- )
1432
+ command:: show_references ( reference_title ( locations. len ( ) ) , & url, pos, locations)
1436
1433
} ) ;
1437
1434
1438
1435
acc. push ( lsp_types:: CodeLens {
0 commit comments