Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spellcheck should not offer the full signatures of explicit members when offering suggestions #44867

Merged
6 commits merged into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,22 @@ interface IGoo
void Goo();
void Goo(int x);
int Prop { get; }
int Generic<K, V>(K key, V value);
CyrusNajmabadi marked this conversation as resolved.
Show resolved Hide resolved
string this[int i] { get; }
void With_Underscore();
}

class Bar : IGoo
{
void IGoo.$$
}";

await VerifyItemExistsAsync(markup, "Goo()");
await VerifyItemExistsAsync(markup, "Goo(int x)");
await VerifyItemExistsAsync(markup, "Goo", displayTextSuffix: "()");
await VerifyItemExistsAsync(markup, "Goo", displayTextSuffix: "(int x)");
await VerifyItemExistsAsync(markup, "Prop");
await VerifyItemExistsAsync(markup, "Generic", displayTextSuffix: "<K, V>(K key, V value)");
await VerifyItemExistsAsync(markup, "this", displayTextSuffix: "[int i]");
await VerifyItemExistsAsync(markup, "With_Underscore", displayTextSuffix: "()");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
Expand All @@ -58,8 +64,8 @@ interface IBar : IGoo
void IGoo.$$
}";

await VerifyItemExistsAsync(markup, "Goo()");
await VerifyItemExistsAsync(markup, "Goo(int x)");
await VerifyItemExistsAsync(markup, "Goo", displayTextSuffix: "()");
await VerifyItemExistsAsync(markup, "Goo", displayTextSuffix: "(int x)");
await VerifyItemExistsAsync(markup, "Prop");
}

Expand All @@ -79,8 +85,8 @@ class Bar : IGoo
void IGoo.$$
}";

await VerifyItemExistsAsync(markup, "Goo()");
await VerifyItemExistsAsync(markup, "Goo(int x)");
await VerifyItemExistsAsync(markup, "Goo", displayTextSuffix: "()");
await VerifyItemExistsAsync(markup, "Goo", displayTextSuffix: "(int x)");
CyrusNajmabadi marked this conversation as resolved.
Show resolved Hide resolved
await VerifyItemExistsAsync(markup, "Prop");
}

Expand All @@ -100,8 +106,8 @@ interface IBar : IGoo
void IGoo.$$
}";

await VerifyItemExistsAsync(markup, "Goo()");
await VerifyItemExistsAsync(markup, "Goo(int x)");
await VerifyItemExistsAsync(markup, "Goo", displayTextSuffix: "()");
await VerifyItemExistsAsync(markup, "Goo", displayTextSuffix: "(int x)");
await VerifyItemExistsAsync(markup, "Prop");
}

Expand Down Expand Up @@ -190,7 +196,7 @@ void I2.$$
await VerifyItemIsAbsentAsync(markup, "GetType()");
await VerifyItemIsAbsentAsync(markup, "ToString()");

await VerifyItemExistsAsync(markup, "Goo2()");
await VerifyItemExistsAsync(markup, "Goo2", displayTextSuffix: "()");
await VerifyItemExistsAsync(markup, "Prop");
}

Expand All @@ -216,7 +222,7 @@ void I1.$$
await VerifyItemIsAbsentAsync(markup, "TestEvent.add");
await VerifyItemIsAbsentAsync(markup, "TestEvent.remove");

await VerifyItemExistsAsync(markup, "Foo()");
await VerifyItemExistsAsync(markup, "Foo", displayTextSuffix: "()");
await VerifyItemExistsAsync(markup, "Prop");
await VerifyItemExistsAsync(markup, "TestEvent");
}
Expand Down Expand Up @@ -365,9 +371,9 @@ protected void Goo2() {}
</Project>
</Workspace>";

await VerifyItemIsAbsentAsync(markup, "Goo1()");
await VerifyItemIsAbsentAsync(markup, "Goo1", displayTextSuffix: "()");
await VerifyItemIsAbsentAsync(markup, "Prop1");
await VerifyItemExistsAsync(markup, "Goo2()");
await VerifyItemExistsAsync(markup, "Goo2", displayTextSuffix: "()");
await VerifyItemExistsAsync(markup, "Prop2");
}

Expand Down Expand Up @@ -401,10 +407,178 @@ protected void Goo2() {}
</Project>
</Workspace>";

await VerifyItemIsAbsentAsync(markup, "Goo1()");
await VerifyItemIsAbsentAsync(markup, "Goo1", displayTextSuffix: "()");
await VerifyItemIsAbsentAsync(markup, "Prop1");
await VerifyItemExistsAsync(markup, "Goo2()");
await VerifyItemExistsAsync(markup, "Goo2", displayTextSuffix: "()");
await VerifyItemExistsAsync(markup, "Prop2");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task VerifySignatureCommit_Generic_Tab()
{
var markup = @"
interface IGoo
{
int Generic<K, V>(K key, V value);
}

class Bar : IGoo
{
void IGoo.$$
}";

var expected = @"
interface IGoo
{
int Generic<K, V>(K key, V value);
}

class Bar : IGoo
{
void IGoo.Generic<K, V>(K key, V value)
}";

await VerifyProviderCommitAsync(markup, "Generic<K, V>(K key, V value)", expected, '\t', "");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task VerifySignatureCommit_Generic_OpenBrace()
{
var markup = @"
interface IGoo
{
int Generic<K, V>(K key, V value);
}

class Bar : IGoo
{
void IGoo.$$
}";

var expected = @"
interface IGoo
{
int Generic<K, V>(K key, V value);
}

class Bar : IGoo
{
void IGoo.Generic<
}";

await VerifyProviderCommitAsync(markup, "Generic<K, V>(K key, V value)", expected, '<', "");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task VerifySignatureCommit_Method_Tab()
{
var markup = @"
interface IGoo
{
int Generic(K key, V value);
}

class Bar : IGoo
{
void IGoo.$$
}";

var expected = @"
interface IGoo
{
int Generic(K key, V value);
}

class Bar : IGoo
{
void IGoo.Generic(K key, V value)
}";

await VerifyProviderCommitAsync(markup, "Generic(K key, V value)", expected, '\t', "");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task VerifySignatureCommit_Method_OpenBrace()
{
var markup = @"
interface IGoo
{
int Generic(K key, V value);
}

class Bar : IGoo
{
void IGoo.$$
}";

var expected = @"
interface IGoo
{
int Generic(K key, V value);
}

class Bar : IGoo
{
void IGoo.Generic(
}";

await VerifyProviderCommitAsync(markup, "Generic(K key, V value)", expected, '(', "");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task VerifySignatureCommit_Indexer_Tab()
{
var markup = @"
interface IGoo
{
int this[K key, V value] { get; }
}

class Bar : IGoo
{
void IGoo.$$
}";

var expected = @"
interface IGoo
{
int this[K key, V value] { get; }
}

class Bar : IGoo
{
void IGoo.this[K key, V value]
}";

await VerifyProviderCommitAsync(markup, "this[K key, V value]", expected, '\t', "");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task VerifySignatureCommit_Indexer_OpenBrace()
{
var markup = @"
interface IGoo
{
int this[K key, V value] { get; }
}

class Bar : IGoo
{
void IGoo.$$
}";

var expected = @"
interface IGoo
{
int this[K key, V value] { get; }
}

class Bar : IGoo
{
void IGoo.this[
}";

await VerifyProviderCommitAsync(markup, "this[K key, V value]", expected, '[', "");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -592,5 +592,91 @@ await TestInRegularAndScriptAsync(
public SomeClass() { }
}");
}

[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsSpellcheck)]
public async Task TestInExplicitInterfaceImplementation1()
{
var text = @"
using System;

class Program : IDisposable
{
void IDisposable.[|Dspose|]
}";

var expected = @"
using System;

class Program : IDisposable
{
void IDisposable.Dispose
}";

await TestInRegularAndScriptAsync(text, expected);
}

[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsSpellcheck)]
public async Task TestInExplicitInterfaceImplementation2()
{
var text = @"
using System;

interface IInterface
{
void Generic<K, V>();
}

class Program : IInterface
{
void IInterface.[|Generi|]
}";

var expected = @"
using System;

interface IInterface
{
void Generic<K, V>();
}

class Program : IInterface
{
void IInterface.Generic
}";

await TestInRegularAndScriptAsync(text, expected);
}

[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsSpellcheck)]
public async Task TestInExplicitInterfaceImplementation3()
{
var text = @"
using System;

interface IInterface
{
int this[int i] { get; }
}

class Program : IInterface
{
void IInterface.[|thi|]
}";

var expected = @"
using System;

interface IInterface
{
int this[int i] { get; }
}

class Program : IInterface
{
void IInterface.this
}";

await TestInRegularAndScriptAsync(text, expected);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,13 @@ protected async Task VerifyCustomCommitProviderAsync(string markupBeforeCommit,
}
}

protected async Task VerifyProviderCommitAsync(string markupBeforeCommit, string itemToCommit, string expectedCodeAfterCommit,
char? commitChar, string textTypedSoFar, SourceCodeKind? sourceCodeKind = null)
protected async Task VerifyProviderCommitAsync(
string markupBeforeCommit,
string itemToCommit,
string expectedCodeAfterCommit,
char? commitChar,
string textTypedSoFar,
SourceCodeKind? sourceCodeKind = null)
{
WorkspaceFixture.GetWorkspace(markupBeforeCommit, ExportProvider);

Expand Down
Loading