提交 57cf9fd2 编写于 作者: R Ravi Chande

Suggest types (and intrinsic type keywords) after "(" when declaring a tuple...

Suggest types (and intrinsic type keywords) after "(" when declaring a tuple type as the type of a member.

Fixes #14127
上级 34a7e3f4
......@@ -8934,6 +8934,50 @@ void M()
await Local<$$";
await VerifyAnyItemExistsAsync(markup);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task TupleTypeAtMemberLevel1()
{
await VerifyItemExistsAsync(@"
class C
{
($$
}", "C");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task TupleTypeAtMemberLevel2()
{
await VerifyItemExistsAsync(@"
class C
{
($$)
}", "C");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task TupleTypeAtMemberLevel3()
{
await VerifyItemExistsAsync(@"
class C
{
(C,
}", "C");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task TupleTypeAtMemberLevel4()
{
await VerifyItemExistsAsync(@"
class C
{
(C, $$)
}", "C");
}
}
}
\ No newline at end of file
......@@ -623,5 +623,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -624,5 +624,31 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -676,5 +676,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -624,5 +624,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}
}");
}
}
}
\ No newline at end of file
......@@ -623,5 +623,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -596,5 +596,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}
}");
}
}
}
\ No newline at end of file
......@@ -692,5 +692,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -623,5 +623,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -630,5 +630,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -623,5 +623,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -617,5 +617,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -657,5 +657,30 @@ public async Task TestNotInCrefTypeParameter()
class C { }
");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -623,5 +623,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -623,5 +623,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -623,5 +623,30 @@ static void Main(string[] args)
}
", matchPriority: SymbolMatchPriority.Keyword);
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
}
}
......@@ -38,6 +38,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -40,6 +40,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -38,6 +38,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -38,6 +38,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -38,6 +38,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -38,6 +38,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -39,6 +39,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -39,6 +39,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -39,6 +39,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -39,6 +39,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -36,7 +36,9 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsDefaultExpressionContext(position, context.LeftToken, cancellationToken) ||
syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
context.IsPossibleTupleContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -39,6 +39,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -39,6 +39,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -39,6 +39,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
context.IsDelegateReturnTypeContext ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
context.IsPossibleTupleContext ||
context.IsMemberDeclarationContext(
validModifiers: SyntaxKindSet.AllMemberModifiers,
validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations,
......
......@@ -684,6 +684,7 @@ public static bool IsDefinitelyNotTypeContext(this SyntaxTree syntaxTree, int po
syntaxTree.IsUsingAliasContext(position, cancellationToken) ||
syntaxTree.IsUsingStaticContext(position, cancellationToken) ||
syntaxTree.IsGlobalMemberDeclarationContext(position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) ||
syntaxTree.IsPossibleTupleContext(tokenOnLeftOfPosition, position) ||
syntaxTree.IsMemberDeclarationContext(
position,
contextOpt: null,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册