@@ -410,7 +410,7 @@ pub(crate) fn signature_help(
410
410
let documentation = call_info. doc . filter ( |_| config. docs ) . map ( |doc| {
411
411
lsp_types:: Documentation :: MarkupContent ( lsp_types:: MarkupContent {
412
412
kind : lsp_types:: MarkupKind :: Markdown ,
413
- value : doc,
413
+ value : crate :: markdown :: format_docs ( & doc) ,
414
414
} )
415
415
} ) ;
416
416
@@ -1410,7 +1410,8 @@ pub(crate) fn rename_error(err: RenameError) -> crate::LspError {
1410
1410
1411
1411
#[ cfg( test) ]
1412
1412
mod tests {
1413
- use ide:: Analysis ;
1413
+ use ide:: { Analysis , FilePosition } ;
1414
+ use test_utils:: extract_offset;
1414
1415
use triomphe:: Arc ;
1415
1416
1416
1417
use super :: * ;
@@ -1451,6 +1452,34 @@ fn main() {
1451
1452
}
1452
1453
}
1453
1454
1455
+ #[ test]
1456
+ fn calling_function_with_ignored_code_in_signature ( ) {
1457
+ let text = r#"
1458
+ fn foo() {
1459
+ bar($0);
1460
+ }
1461
+ /// ```
1462
+ /// # use crate::bar;
1463
+ /// bar(5);
1464
+ /// ```
1465
+ fn bar(_: usize) {}
1466
+ "# ;
1467
+
1468
+ let ( offset, text) = extract_offset ( text) ;
1469
+ let ( analysis, file_id) = Analysis :: from_single_file ( text) ;
1470
+ let help = signature_help (
1471
+ analysis. signature_help ( FilePosition { file_id, offset } ) . unwrap ( ) . unwrap ( ) ,
1472
+ CallInfoConfig { params_only : false , docs : true } ,
1473
+ false ,
1474
+ ) ;
1475
+ let docs = match & help. signatures [ help. active_signature . unwrap ( ) as usize ] . documentation {
1476
+ Some ( lsp_types:: Documentation :: MarkupContent ( content) ) => & content. value ,
1477
+ _ => panic ! ( "documentation contains markup" ) ,
1478
+ } ;
1479
+ assert ! ( docs. contains( "bar(5)" ) ) ;
1480
+ assert ! ( !docs. contains( "use crate::bar" ) ) ;
1481
+ }
1482
+
1454
1483
// `Url` is not able to parse windows paths on unix machines.
1455
1484
#[ test]
1456
1485
#[ cfg( target_os = "windows" ) ]
0 commit comments