@@ -19,7 +19,7 @@ use tracing::{debug, error, info, warn};
1919use crate :: formatting;
2020use crate :: parsing;
2121use crate :: parsing:: ParsingError ;
22- use crate :: problem:: { calculate_column_number, calculate_line_number} ;
22+ use crate :: problem:: { calculate_column_number, calculate_line_number, Present } ;
2323
2424pub struct TechniqueLanguageServer {
2525 /// Map from URI to document content
@@ -483,29 +483,47 @@ impl TechniqueLanguageServer {
483483 ) -> Vec < SymbolInformation > {
484484 let mut symbols = Vec :: new ( ) ;
485485
486+ // Create URI from the path for the Location
487+ let uri: Uri = format ! ( "file://{}" , path. display( ) )
488+ . parse ( )
489+ . unwrap ( ) ;
490+
486491 if let Some ( ref body) = document. body {
487492 match body {
488493 Technique :: Procedures ( procedures) => {
489494 for procedure in procedures {
495+ let text: String ;
496+
490497 let name = procedure
491498 . name
492499 . 0 ;
493500
494501 // Calculate the byte offset of the name using pointer arithmetic
495502 let offset = calculate_slice_offset ( content, name) . unwrap_or ( 0 ) ;
496- let position = offset_to_position ( content, offset) ;
503+ let position_start = offset_to_position ( content, offset) ;
504+
505+ if let Some ( signature) = & procedure. signature {
506+ text = format ! ( "{} : {}" , name, signature. present( & Identity ) ) ;
507+ } else {
508+ text = format ! ( "{} :" , name) ;
509+ }
510+
511+ let position_end = Position {
512+ line : position_start. line ,
513+ character : position_start. character + text. len ( ) as u32 ,
514+ } ;
497515
498516 #[ allow( deprecated) ]
499517 let symbol = SymbolInformation {
500- name : name . to_string ( ) ,
518+ name : text ,
501519 kind : SymbolKind :: CONSTRUCTOR ,
502520 tags : None ,
503521 deprecated : None , // deprecated but still required, how annoying
504522 location : Location {
505523 uri : uri. clone ( ) ,
506524 range : Range {
507- start : position ,
508- end : position ,
525+ start : position_start ,
526+ end : position_end ,
509527 } ,
510528 } ,
511529 container_name : None ,
0 commit comments