@@ -40,7 +40,7 @@ await VerifyHoverAsync(code, async (hover, document) =>
4040 Container (
4141 Container (
4242 Image ,
43- ClassifiedText (
43+ ClassifiedText ( // Microsoft.AspNetCore.Components.Web.PageTitle
4444 Text ( "Microsoft" ) ,
4545 Punctuation ( "." ) ,
4646 Text ( "AspNetCore" ) ,
@@ -67,6 +67,7 @@ public async Task Html()
6767 }
6868 """ ;
6969
70+ // This simply verifies that Hover will call into HTML.
7071 var htmlResponse = new VSInternalHover ( ) ;
7172
7273 await VerifyHoverAsync ( code , htmlResponse , h => Assert . Same ( htmlResponse , h ) ) ;
@@ -94,7 +95,7 @@ await VerifyHoverAsync(code, async (hover, document) =>
9495 Container (
9596 Container (
9697 Image ,
97- ClassifiedText (
98+ ClassifiedText ( // (local variable) string myVariable
9899 Punctuation ( "(" ) ,
99100 Text ( "local variable" ) ,
100101 Punctuation ( ")" ) ,
@@ -105,6 +106,45 @@ await VerifyHoverAsync(code, async (hover, document) =>
105106 } ) ;
106107 }
107108
109+ [ Fact ]
110+ public async Task ComponentAttribute ( )
111+ {
112+ // Component attributes are within HTML but actually map to C#.
113+ // In this situation, Hover prefers treating the position as C# and calls
114+ // Roslyn rather than HTML.
115+
116+ TestCode code = """
117+ <EditForm [|Form$$Name|]="Hello" />
118+ """ ;
119+
120+ await VerifyHoverAsync ( code , async ( hover , document ) =>
121+ {
122+ await hover . VerifyRangeAsync ( code . Span , document ) ;
123+
124+ hover . VerifyRawContent (
125+ Container (
126+ Container (
127+ Image ,
128+ ClassifiedText ( // string? EditForm.FormName { get; set; }
129+ Keyword ( "string" ) ,
130+ Punctuation ( "?" ) ,
131+ WhiteSpace ( " " ) ,
132+ ClassName ( "EditForm" ) ,
133+ Punctuation ( "." ) ,
134+ PropertyName ( "FormName" ) ,
135+ WhiteSpace ( " " ) ,
136+ Punctuation ( "{" ) ,
137+ WhiteSpace ( " " ) ,
138+ Keyword ( "get" ) ,
139+ Punctuation ( ";" ) ,
140+ WhiteSpace ( " " ) ,
141+ Keyword ( "set" ) ,
142+ Punctuation ( ";" ) ,
143+ WhiteSpace ( " " ) ,
144+ Punctuation ( "}" ) ) ) ) ) ;
145+ } ) ;
146+ }
147+
108148 private async Task VerifyHoverAsync ( TestCode input , Func < RoslynHover , TextDocument , Task > verifyHover )
109149 {
110150 var document = await CreateProjectAndRazorDocumentAsync ( input . Text ) ;
0 commit comments