File tree 1 file changed +9
-12
lines changed
crates/ra_lsp_server/src/main_loop
1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -514,29 +514,26 @@ pub fn handle_hover(
514
514
Some ( it) => it,
515
515
} ;
516
516
let mut result = Vec :: new ( ) ;
517
+ let file_id = params. text_document . try_conv_with ( & world) ?;
518
+ let file_range = FileRange {
519
+ file_id,
520
+ range : rr. reference_range ,
521
+ } ;
522
+ if let Some ( type_name) = world. analysis ( ) . type_of ( file_range) ? {
523
+ result. push ( type_name) ;
524
+ }
517
525
for nav in rr. resolves_to {
518
526
if let Some ( docs) = world. analysis ( ) . doc_text_for ( nav) ? {
519
527
result. push ( docs) ;
520
528
}
521
529
}
530
+
522
531
let range = rr. reference_range . conv_with ( & line_index) ;
523
532
if result. len ( ) > 0 {
524
533
return Ok ( Some ( Hover {
525
534
contents : HoverContents :: Scalar ( MarkedString :: String ( result. join ( "\n \n ---\n " ) ) ) ,
526
535
range : Some ( range) ,
527
536
} ) ) ;
528
- } else {
529
- let file_id = params. text_document . try_conv_with ( & world) ?;
530
- let file_range = FileRange {
531
- file_id,
532
- range : rr. reference_range ,
533
- } ;
534
- if let Some ( type_name) = world. analysis ( ) . type_of ( file_range) ? {
535
- return Ok ( Some ( Hover {
536
- contents : HoverContents :: Scalar ( MarkedString :: String ( type_name) ) ,
537
- range : Some ( range) ,
538
- } ) ) ;
539
- }
540
537
}
541
538
Ok ( None )
542
539
}
You can’t perform that action at this time.
0 commit comments