提交 2af7f65e 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #21425 from CyrusNajmabadi/caseKeywordRecommend

Recommend 'case' keyword after a pattern-case-clause.
......@@ -94,6 +94,15 @@ public async Task TestAfterDefault()
$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterPatternCase()
{
await VerifyKeywordAsync(AddInsideMethod(
@"switch (expr) {
case String s:
$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterOneStatement()
{
......@@ -104,6 +113,17 @@ public async Task TestAfterOneStatement()
$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterOneStatementPatternCase()
{
await VerifyKeywordAsync(AddInsideMethod(
@"switch (expr) {
case String s:
Console.WriteLine();
$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterTwoStatements()
{
......@@ -125,6 +145,16 @@ public async Task TestAfterBlock()
$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterBlockPatternCase()
{
await VerifyKeywordAsync(AddInsideMethod(
@"switch (expr) {
case String s: {
}
$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterIfElse()
{
......
......@@ -387,7 +387,8 @@ public static bool IsSwitchLabelContext(this SyntaxToken targetToken)
if (targetToken.Kind() == SyntaxKind.ColonToken)
{
if (targetToken.Parent.IsKind(SyntaxKind.CaseSwitchLabel, SyntaxKind.DefaultSwitchLabel))
if (targetToken.Parent.IsKind(
SyntaxKind.CaseSwitchLabel, SyntaxKind.DefaultSwitchLabel, SyntaxKind.CasePatternSwitchLabel))
{
return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册