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

Update help service to account for all TypeDeclarationSyntax (namespace+record+struct) as partial type #48095

Merged
merged 5 commits into from
Sep 28, 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 @@ -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