提交 9aa3c76c 编写于 作者: S Sam Harwell 提交者: GitHub

Merge pull request #20645 from zaytsev-victor/Fixed19947

Fixed completion list for explicit interface implementation
......@@ -98,5 +98,36 @@ class Bar : IFoo
await VerifyProviderCommitAsync(markup, "Foo()", expected, '(', "");
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(19947, "https://github.com/dotnet/roslyn/issues/19947")]
public async Task ExplicitInterfaceMemberCompletionContainsOnlyValidValues()
{
var markup = @"
interface I1
{
void Foo();
}
interface I2 : I1
{
void Foo2();
int Prop { get; }
}
class Bar : I2
{
void I2.$$
}";
await VerifyItemIsAbsentAsync(markup, "Equals(object obj)");
await VerifyItemIsAbsentAsync(markup, "Foo()");
await VerifyItemIsAbsentAsync(markup, "GetHashCode()");
await VerifyItemIsAbsentAsync(markup, "GetType()");
await VerifyItemIsAbsentAsync(markup, "ToString()");
await VerifyItemExistsAsync(markup, "Foo2()");
await VerifyItemExistsAsync(markup, "Prop");
}
}
}
......@@ -82,7 +82,7 @@ public override async Task ProvideCompletionsAsync(CompletionContext context)
var members = semanticModel.LookupSymbols(
position: name.SpanStart,
container: symbol)
.WhereAsArray(s => !s.IsStatic)
.WhereAsArray(s => !s.IsStatic && s.ContainingType.Equals(symbol))
.FilterToVisibleAndBrowsableSymbols(options.GetOption(CompletionOptions.HideAdvancedMembers, semanticModel.Language), semanticModel.Compilation);
// We're going to create a entry for each one, including the signature
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册