Skip to content

Commit

Permalink
Offer 'readonly' completion in type contexts (#26186)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv authored May 2, 2018
1 parent 3adcd5e commit 8424006
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ await VerifyKeywordAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterNestedReadOnly()
public async Task TestAfterNestedReadOnly()
{
await VerifyAbsenceAsync(@"class C {
await VerifyKeywordAsync(@"class C {
readonly $$");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ await VerifyAbsenceAsync(AddInsideMethod(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInCompilationUnit()
public async Task TestInCompilationUnit()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"$$");
await VerifyKeywordAsync(SourceCodeKind.Regular, @"$$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterExtern()
public async Task TestAfterExtern()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"extern alias Goo;
await VerifyKeywordAsync(SourceCodeKind.Regular, @"extern alias Goo;
$$");
}

Expand All @@ -75,9 +75,9 @@ public async Task TestAfterExtern_Interactive()
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterUsing()
public async Task TestAfterUsing()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"using Goo;
await VerifyKeywordAsync(SourceCodeKind.Regular, @"using Goo;
$$");
}

Expand All @@ -89,23 +89,23 @@ public async Task TestAfterUsing_Interactive()
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterNamespace()
public async Task TestAfterNamespace()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"namespace N {}
await VerifyKeywordAsync(SourceCodeKind.Regular, @"namespace N {}
$$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterTypeDeclaration()
public async Task TestAfterTypeDeclaration()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"class C {}
await VerifyKeywordAsync(SourceCodeKind.Regular, @"class C {}
$$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterDelegateDeclaration()
public async Task TestAfterDelegateDeclaration()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"delegate void Goo();
await VerifyKeywordAsync(SourceCodeKind.Regular, @"delegate void Goo();
$$");
}

Expand Down Expand Up @@ -153,9 +153,9 @@ await VerifyAbsenceAsync(SourceCodeKind.Script,
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterAssemblyAttribute()
public async Task TestAfterAssemblyAttribute()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"[assembly: goo]
await VerifyKeywordAsync(SourceCodeKind.Regular, @"[assembly: goo]
$$");
}

Expand All @@ -167,9 +167,9 @@ await VerifyKeywordAsync(SourceCodeKind.Script, @"[assembly: goo]
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterRootAttribute()
public async Task TestAfterRootAttribute()
{
await VerifyAbsenceAsync(@"[goo]
await VerifyKeywordAsync(@"[goo]
$$");
}

Expand Down Expand Up @@ -213,21 +213,21 @@ await VerifyKeywordAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterPartial()
public async Task TestAfterPartial()
{
await VerifyAbsenceAsync(@"partial $$");
await VerifyKeywordAsync(@"partial $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterAbstract()
public async Task TestAfterAbstract()
{
await VerifyAbsenceAsync(@"abstract $$");
await VerifyKeywordAsync(@"abstract $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterInternal()
public async Task TestAfterInternal()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"internal $$");
await VerifyKeywordAsync(SourceCodeKind.Regular, @"internal $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
Expand All @@ -245,9 +245,9 @@ await VerifyKeywordAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterPublic()
public async Task TestAfterPublic()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"public $$");
await VerifyKeywordAsync(SourceCodeKind.Regular, @"public $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
Expand All @@ -265,9 +265,9 @@ await VerifyKeywordAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterPrivate()
public async Task TestAfterPrivate()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular,
await VerifyKeywordAsync(SourceCodeKind.Regular,
@"private $$");
}

Expand All @@ -287,9 +287,9 @@ await VerifyKeywordAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterProtected()
public async Task TestAfterProtected()
{
await VerifyAbsenceAsync(
await VerifyKeywordAsync(
@"protected $$");
}

Expand All @@ -302,23 +302,23 @@ await VerifyKeywordAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterSealed()
public async Task TestAfterSealed()
{
await VerifyAbsenceAsync(@"sealed $$");
await VerifyKeywordAsync(@"sealed $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterNestedSealed()
public async Task TestAfterNestedSealed()
{
await VerifyAbsenceAsync(
await VerifyKeywordAsync(
@"class C {
sealed $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterStatic()
public async Task TestAfterStatic()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"static $$");
await VerifyKeywordAsync(SourceCodeKind.Regular, @"static $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
Expand All @@ -336,9 +336,9 @@ await VerifyKeywordAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterStaticPublic()
public async Task TestAfterStaticPublic()
{
await VerifyAbsenceAsync(SourceCodeKind.Regular, @"static public $$");
await VerifyKeywordAsync(SourceCodeKind.Regular, @"static public $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
Expand Down Expand Up @@ -378,9 +378,9 @@ await VerifyAbsenceAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterReadOnly()
public async Task TestAfterReadOnly()
{
await VerifyAbsenceAsync(
await VerifyKeywordAsync(
@"class C {
readonly $$");
}
Expand All @@ -394,10 +394,33 @@ await VerifyAbsenceAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterNew()
public async Task TestAfterRef()
{
await VerifyAbsenceAsync(
@"new $$");
await VerifyKeywordAsync(SourceCodeKind.Regular, @"ref $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInRefStruct()
{
await VerifyKeywordAsync(SourceCodeKind.Regular, @"ref $$ struct { }");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInRefStructBeforeRef()
{
await VerifyKeywordAsync(SourceCodeKind.Regular, @"$$ ref struct { }");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNew()
{
await VerifyKeywordAsync(SourceCodeKind.Regular, @"new $$");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNewInClass()
{
await VerifyKeywordAsync(SourceCodeKind.Regular, @"class C { new $$ }");
}

[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
Expand Down
Loading

0 comments on commit 8424006

Please sign in to comment.