diff --git a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExplicitInterfaceTypeCompletionProviderTests.cs b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExplicitInterfaceTypeCompletionProviderTests.cs index df17a7b37fd42..05958472e61e1 100644 --- a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExplicitInterfaceTypeCompletionProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExplicitInterfaceTypeCompletionProviderTests.cs @@ -322,5 +322,41 @@ async Task $$ await VerifyAnyItemExistsAsync(markup, hasSuggestionModeItem: true); await VerifyItemExistsAsync(markup, "IGoo"); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/70382")] + public async Task TestAfterGenericType() + { + var markup = """ + interface I + { + I M(); + } + + class C : I + { + I $$ + } + """; + + await VerifyItemExistsAsync(markup, "I", displayTextSuffix: "<>"); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/70382")] + public async Task TestAfterNestedGenericType() + { + var markup = """ + interface I + { + I M(); + } + + class C : I + { + I> $$ + } + """; + + await VerifyItemExistsAsync(markup, "I", displayTextSuffix: "<>"); + } } } diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/ExplicitInterfaceTypeCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/ExplicitInterfaceTypeCompletionProvider.cs index 9a0e864f93ea9..df26a884f5357 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/ExplicitInterfaceTypeCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/ExplicitInterfaceTypeCompletionProvider.cs @@ -75,7 +75,11 @@ protected override Task> GetSymbolsAsync( if (SyntaxFacts.GetContextualKeywordKind(targetToken.ValueText) == SyntaxKind.AsyncKeyword) return SpecializedTasks.EmptyImmutableArray(); - var typeNode = targetToken.Parent as TypeSyntax; + var potentialTypeNode = targetToken.Parent; + if (targetToken.IsKind(SyntaxKind.GreaterThanToken) && potentialTypeNode is TypeArgumentListSyntax typeArgumentList) + potentialTypeNode = typeArgumentList.Parent; + + var typeNode = potentialTypeNode as TypeSyntax; while (typeNode != null) {