@@ -527,6 +527,7 @@ public async Task<string> DoAsync()
527
527
expectedLocation ) . ConfigureAwait ( false ) ;
528
528
Assert . Equal ( expectedMarkdown , results . Contents . Fourth . Value ) ;
529
529
}
530
+
530
531
[ Theory , CombinatorialData ]
531
532
public async Task TestGetHoverAsync_UsesNonBreakingSpaceForSupportedPlatforms ( bool mutatingLspWorkspace )
532
533
{
@@ -586,6 +587,47 @@ static void Main(string[] args)
586
587
Assert . Equal ( expectedMarkdown , result . Contents . Fourth . Value ) ;
587
588
}
588
589
590
+ [ Theory , CombinatorialData , WorkItem ( "https://github.com/dotnet/vscode-csharp/issues/6577" ) ]
591
+ public async Task TestGetHoverAsync_EscapesAngleBracketsInGenerics ( bool mutatingLspWorkspace )
592
+ {
593
+ var markup =
594
+ """
595
+ using System.Collections.Generic;
596
+ using System.Collections.Immutable;
597
+ using System.Threading.Tasks;
598
+ class C
599
+ {
600
+ private async Task<IDictionary<string, ImmutableArray<int>>> GetData()
601
+ {
602
+ {|caret:var|} d = await GetData();
603
+ return null;
604
+ }
605
+ }
606
+ """ ;
607
+ var clientCapabilities = new LSP . ClientCapabilities
608
+ {
609
+ TextDocument = new LSP . TextDocumentClientCapabilities { Hover = new LSP . HoverSetting { ContentFormat = [ LSP . MarkupKind . Markdown ] } }
610
+ } ;
611
+ await using var testLspServer = await CreateTestLspServerAsync ( markup , mutatingLspWorkspace , clientCapabilities ) ;
612
+ var expectedLocation = testLspServer . GetLocations ( "caret" ) . Single ( ) ;
613
+
614
+ var expectedMarkdown = """
615
+ ```csharp
616
+ interface System.Collections.Generic.IDictionary<TKey, TValue>
617
+ ```
618
+
619
+
620
+ TKey is string
621
+ TValue is ImmutableArray\<int\>
622
+
623
+ """ ;
624
+
625
+ var results = await RunGetHoverAsync (
626
+ testLspServer ,
627
+ expectedLocation ) . ConfigureAwait ( false ) ;
628
+ Assert . Equal ( expectedMarkdown , results . Contents . Fourth . Value ) ;
629
+ }
630
+
589
631
private static async Task < LSP . Hover > RunGetHoverAsync (
590
632
TestLspServer testLspServer ,
591
633
LSP . Location caret ,
0 commit comments