提交 728ee14b 编写于 作者: Š Šimon Koníček

Adding full completion after 'when'

上级 821ae7dc
......@@ -8697,6 +8697,25 @@ void M(bool x)
await VerifyItemExistsAsync(markup, "x");
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task ExceptionFilter1_NotBeforeOpenParen()
{
var markup = @"
using System;
class C
{
void M(bool x)
{
try
{
}
catch when $$
";
await VerifyNoItemsExistAsync(markup);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task ExceptionFilter2()
{
......@@ -8716,6 +8735,59 @@ void M(bool x)
await VerifyItemExistsAsync(markup, "x");
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task ExceptionFilter2_NotBeforeOpenParen()
{
var markup = @"
using System;
class C
{
void M(bool x)
{
try
{
}
catch (Exception ex) when $$
";
await VerifyNoItemsExistAsync(markup);
}
[WorkItem(25084, "https://github.com/dotnet/roslyn/issues/25084")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task SwitchCaseWhenClause()
{
var markup = @"
class C
{
void M(bool x)
{
switch (1)
{
case 1 when $$
";
await VerifyItemExistsAsync(markup, "x");
}
[WorkItem(25084, "https://github.com/dotnet/roslyn/issues/25084")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task SwitchPatternCaseWhenClause()
{
var markup = @"
class C
{
void M(bool x)
{
switch (1)
{
case int i when $$
";
await VerifyItemExistsAsync(markup, "x");
}
[WorkItem(717, "https://github.com/dotnet/roslyn/issues/717")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task ExpressionContextCompletionWithinCast()
......
......@@ -74,6 +74,7 @@ public async Task TestForSwitchCase_AfterDeclarationPattern()
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[WorkItem(25084, "https://github.com/dotnet/roslyn/issues/25084")]
public async Task TestForSwitchCase_AfterLiteral()
{
await VerifyKeywordAsync(AddInsideMethod(@"switch (1) { case 1 $$ }"));
......
......@@ -2410,6 +2410,12 @@ public static bool IsLabelContext(this SyntaxTree syntaxTree, int position, Canc
return true;
}
// case ... when |
if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause))
{
return true;
}
// (SomeType) |
if (token.IsAfterPossibleCast())
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册