@@ -176,7 +176,7 @@ void ValidateResolveParams(DelegatedCompletionItemResolveParams @params)
176
176
public async Task ResolveAsync_CSharp_Resolves ( )
177
177
{
178
178
// Arrange & Act
179
- var resolvedItem = await ResolveCompletionItemAsync ( "@$$" , itemToResolve : "typeof" , DisposalToken ) ;
179
+ var resolvedItem = await ResolveCompletionItemAsync ( "@$$" , itemToResolve : "typeof" , supportsVisualStudioExtensions : true , DisposalToken ) ;
180
180
181
181
// Assert
182
182
Assert . NotNull ( resolvedItem . Description ) ;
@@ -208,7 +208,7 @@ async Task FooAsync()
208
208
""" ) ;
209
209
210
210
// Act
211
- var resolvedItem = await ResolveCompletionItemAsync ( input , itemToResolve : "await" , DisposalToken ) ;
211
+ var resolvedItem = await ResolveCompletionItemAsync ( input , itemToResolve : "await" , supportsVisualStudioExtensions : true , DisposalToken ) ;
212
212
213
213
// Assert
214
214
var textChange = originalSourceText . GetTextChange ( resolvedItem . TextEdit . Value . First ) ;
@@ -278,6 +278,37 @@ Task FooAsync()
278
278
AssertEx . EqualOrDiff ( expectedSourceText . ToString ( ) , actualSourceText . ToString ( ) ) ;
279
279
}
280
280
281
+ [ Fact ]
282
+ public async Task ResolveAsync_CSharp_OverrideCompletion ( )
283
+ {
284
+ // Arrange
285
+ var input =
286
+ """
287
+ @code {
288
+ override $$
289
+ }
290
+ """ ;
291
+ TestFileMarkupParser . GetPosition ( input , out var documentContent , out _ ) ;
292
+ var originalSourceText = SourceText . From ( documentContent ) ;
293
+ var expectedSourceText = SourceText . From (
294
+ """
295
+ @using System.Threading.Tasks
296
+ @code {
297
+ protected override Task OnInitializedAsync()
298
+ {
299
+ return base.OnInitializedAsync();
300
+ }
301
+ }
302
+ """ ) ;
303
+
304
+ // Act
305
+ var resolvedItem = await ResolveCompletionItemAsync ( input , itemToResolve : "OnInitializedAsync()" , supportsVisualStudioExtensions : false , DisposalToken ) ;
306
+
307
+ var textChange = originalSourceText . GetTextChange ( ( TextEdit ) resolvedItem . Command . Arguments [ 1 ] ) ;
308
+ var actualSourceText = originalSourceText . WithChanges ( textChange ) ;
309
+ AssertEx . EqualOrDiff ( expectedSourceText . ToString ( ) , actualSourceText . ToString ( ) ) ;
310
+ }
311
+
281
312
[ Fact ]
282
313
public async Task ResolveAsync_Html_Resolves ( )
283
314
{
@@ -306,11 +337,11 @@ void ValidateResolveParams(DelegatedCompletionItemResolveParams @params)
306
337
}
307
338
}
308
339
309
- private async Task < VSInternalCompletionItem > ResolveCompletionItemAsync ( string content , string itemToResolve , CancellationToken cancellationToken )
340
+ private async Task < VSInternalCompletionItem > ResolveCompletionItemAsync ( string content , string itemToResolve , bool supportsVisualStudioExtensions , CancellationToken cancellationToken )
310
341
{
311
342
TestFileMarkupParser . GetPosition ( content , out var documentContent , out var cursorPosition ) ;
312
343
var codeDocument = CreateCodeDocument ( documentContent , filePath : "C:/path/to/file.razor" ) ;
313
- await using var csharpServer = await CreateCSharpServerAsync ( codeDocument , supportsVisualStudioExtensions : true ) ;
344
+ await using var csharpServer = await CreateCSharpServerAsync ( codeDocument , supportsVisualStudioExtensions ) ;
314
345
315
346
var clientConnection = CreateClientConnectionForResolve ( csharpServer ) ;
316
347
var documentContextFactory = new TestDocumentContextFactory ( "C:/path/to/file.razor" , codeDocument ) ;
0 commit comments