@@ -410,7 +410,7 @@ pub(crate) fn signature_help(
410410 let documentation = call_info. doc . filter ( |_| config. docs ) . map ( |doc| {
411411 lsp_types:: Documentation :: MarkupContent ( lsp_types:: MarkupContent {
412412 kind : lsp_types:: MarkupKind :: Markdown ,
413- value : doc,
413+ value : crate :: markdown :: format_docs ( & doc) ,
414414 } )
415415 } ) ;
416416
@@ -1410,7 +1410,8 @@ pub(crate) fn rename_error(err: RenameError) -> crate::LspError {
14101410
14111411#[ cfg( test) ]
14121412mod tests {
1413- use ide:: Analysis ;
1413+ use ide:: { Analysis , FilePosition } ;
1414+ use test_utils:: extract_offset;
14141415 use triomphe:: Arc ;
14151416
14161417 use super :: * ;
@@ -1451,6 +1452,34 @@ fn main() {
14511452 }
14521453 }
14531454
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+
14541483 // `Url` is not able to parse windows paths on unix machines.
14551484 #[ test]
14561485 #[ cfg( target_os = "windows" ) ]
0 commit comments