提交 23497c53 编写于 作者: R Ravi Chande 提交者: GitHub

Merge pull request #18829 from rchande/fix18006

Include generic interfaces in implements clause completion
......@@ -739,5 +739,60 @@ Class B
Await VerifyNoItemsExistAsync(text)
End Function
<WorkItem(18006, "https://github.com/dotnet/roslyn/issues/18006")>
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ShowGenericTypes() As Task
Dim text = <text>Interface I(Of T)
Sub Foo()
End Interface
Class B
Implements I(Of Integer)
Public Sub Foo() Implements $$
</text>.Value
Await VerifyItemExistsAsync(text, "I(Of Integer)")
End Function
<WorkItem(18006, "https://github.com/dotnet/roslyn/issues/18006")>
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ShowGenericTypes2() As Task
Dim text = <text>Interface I(Of T)
Sub Foo()
End Interface
Class B(Of T)
Implements I(Of T)
Public Sub Foo() Implements $$
End Sub
End Class
</text>.Value
Await VerifyItemExistsAsync(text, "I(Of T)")
End Function
<WorkItem(18006, "https://github.com/dotnet/roslyn/issues/18006")>
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ShowGenericTypes3() As Task
Dim text = <text>Interface I(Of T)
Sub Foo()
End Interface
Class B(Of T)
Implements I(Of Integer)
Public Sub Foo() Implements
End Sub
End Class
</text>.Value
Await VerifyItemExistsAsync(text, "I(Of T)")
End Function
End Class
End Namespace
\ No newline at end of file
......@@ -162,7 +162,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End If
Dim interfaceWithUnimplementedMembers = containingType.GetAllUnimplementedMembersInThis(containingType.Interfaces, AddressOf interfaceMemberGetter, cancellationToken) _
.Where(Function(i) i.Item2.Any(Function(s) MatchesMemberKind(s, kind))) _
.Where(Function(i) i.Item2.Any(Function(interfaceOrContainer) MatchesMemberKind(interfaceOrContainer, kind))) _
.Select(Function(i) i.Item1)
Dim interfacesAndContainers = New HashSet(Of ISymbol)(interfaceWithUnimplementedMembers)
......@@ -170,9 +170,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
AddAliasesAndContainers(i, interfacesAndContainers, node, semanticModel)
Next
Dim symbols = semanticModel.LookupSymbols(position)
Dim symbols = New HashSet(Of ISymbol)(semanticModel.LookupSymbols(position))
Dim availableInterfacesAndContainers = interfacesAndContainers.Where(
Function(interfaceOrContainer) symbols.Contains(interfaceOrContainer.OriginalDefinition)).ToImmutableArray()
Dim result = TryAddGlobalTo(interfacesAndContainers.Intersect(symbols.ToArray()).ToImmutableArray())
Dim result = TryAddGlobalTo(availableInterfacesAndContainers)
' Even if there's not anything left to implement, we'll show the list of interfaces,
' the global namespace, and the project root namespace (if any), as long as the class implements something.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册