@@ -61,9 +61,15 @@ func FindReferences(ctx context.Context, client *lsp.Client, args FindReferences
6161refsByFile [ref .URI ] = append (refsByFile [ref .URI ], ref )
6262}
6363
64+ banner := strings .Repeat ("=" , 80 ) + "\n "
65+ header := fmt .Sprintf ("References for symbol: %s\n " , args .SymbolName )
66+ allReferences = append (allReferences , banner + header + banner )
67+
6468// Process each file's references
6569for uri , fileRefs := range refsByFile {
66- fileInfo := fmt .Sprintf ("\n References in %s:\n " , strings .TrimPrefix (string (uri ), "file://" ))
70+ fileInfo := fmt .Sprintf ("\n File: %s\n %s\n " ,
71+ strings .TrimPrefix (string (uri ), "file://" ),
72+ strings .Repeat ("-" , 80 ))
6773allReferences = append (allReferences , fileInfo )
6874
6975for _ , ref := range fileRefs {
@@ -77,7 +83,7 @@ func FindReferences(ctx context.Context, client *lsp.Client, args FindReferences
7783snippet = addLineNumbers (snippet , int (ref .Range .Start .Line )+ 1 )
7884}
7985
80- refInfo := fmt .Sprintf (" Line %d, Column %d:\n %s\n " ,
86+ refInfo := fmt .Sprintf ("Reference at Line %d, Column %d:\n %s\n " ,
8187ref .Range .Start .Line + 1 ,
8288ref .Range .Start .Character + 1 ,
8389snippet ,
@@ -89,7 +95,9 @@ func FindReferences(ctx context.Context, client *lsp.Client, args FindReferences
8995}
9096
9197if len (allReferences ) == 0 {
92- return fmt .Sprintf ("No references found for %s" , args .SymbolName ), nil
98+ banner := strings .Repeat ("=" , 80 ) + "\n "
99+ return fmt .Sprintf ("%sNo references found for symbol: %s\n %s" ,
100+ banner , args .SymbolName , banner ), nil
93101}
94102
95103return strings .Join (allReferences , "\n " ), nil
0 commit comments