Skip to content

Commit

Permalink
Update help service to account for all TypeDeclarationSyntax (names…
Browse files Browse the repository at this point in the history
…pace+record+struct) as partial type (#48095)
  • Loading branch information
Youssef1313 authored Sep 28, 2020
1 parent d3131e5 commit 2366c3c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private static bool TryGetTextForContextualKeyword(SyntaxToken token, out string
text = "partialmethod_CSharpKeyword";
return true;
}
else if (token.Parent.GetAncestorOrThis<ClassDeclarationSyntax>() != null)
else if (token.Parent.GetAncestorOrThis<TypeDeclarationSyntax>() != null)
{
text = "partialtype_CSharpKeyword";
return true;
Expand Down
34 changes: 32 additions & 2 deletions src/VisualStudio/CSharp/Test/F1Help/F1HelpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void goo()
}

[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPartialType()
public async Task TestClassPartialType()
{
await Test_KeywordAsync(
@"part[||]ial class C
Expand All @@ -174,7 +174,27 @@ await Test_KeywordAsync(
}

[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPartialMethod()
public async Task TestRecordPartialType()
{
await Test_KeywordAsync(
@"part[||]ial record C
{
partial void goo();
}", "partialtype");
}

[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestRecordWithPrimaryConstructorPartialType()
{
await Test_KeywordAsync(
@"part[||]ial record C(string S)
{
partial void goo();
}", "partialtype");
}

[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPartialMethodInClass()
{
await Test_KeywordAsync(
@"partial class C
Expand All @@ -183,6 +203,16 @@ await Test_KeywordAsync(
}", "partialmethod");
}

[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestPartialMethodInRecord()
{
await Test_KeywordAsync(
@"partial record C
{
par[||]tial void goo();
}", "partialmethod");
}

[Fact, Trait(Traits.Feature, Traits.Features.F1Help)]
public async Task TestExtendedPartialMethod()
{
Expand Down

0 comments on commit 2366c3c

Please sign in to comment.