Recommenders for data and with#43971
Conversation
|
What is hte 'data' keyword? |
It's the current keyword for records: https://github.com/dotnet/csharplang/blob/master/proposals/records-wip.md |
|
@CyrusNajmabadi for review. Thanks |
| showCompletionInArgumentLists:=showCompletionInArgumentLists) | ||
|
|
||
| state.SendTypeChars("w") | ||
| state.SendTypeChars("z") |
| { | ||
| return | ||
| context.IsGlobalStatementContext || | ||
| context.TargetToken.IsUsingKeywordInUsingDirective() || |
There was a problem hiding this comment.
Good catch, I'll remove. This is a bad carry-over from the static recommender I started from.
| return CheckPreviousModifiers(context); | ||
| } | ||
|
|
||
| return false; |
There was a problem hiding this comment.
do we have test with things like ref data partial struct (and permutations)?
There was a problem hiding this comment.
question still applies
There was a problem hiding this comment.
Sorry, I thought I addressed that comment. We have a test for partial $$ and one for ref $$. I don't think that what follows the $$ matters, but I can add such tests if you think it's useful.
There was a problem hiding this comment.
data is a contextual keyword only directly before class at the moment, so if anything here relies on data being a contextual keyword, that won't work.
There was a problem hiding this comment.
@agocke I've already accounted for that, since you won't have typed class at the time you want to type data. We had a similar problem with partial or ref I think.
| validModifiers: SyntaxKindSet.AllTypeModifiers, | ||
| validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations, | ||
| canBePartial: true, | ||
| cancellationToken: cancellationToken)) |
There was a problem hiding this comment.
| validModifiers: SyntaxKindSet.AllTypeModifiers, | |
| validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations, | |
| canBePartial: true, | |
| cancellationToken: cancellationToken)) | |
| validModifiers: SyntaxKindSet.AllTypeModifiers, | |
| validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructTypeDeclarations, | |
| canBePartial: true, | |
| cancellationToken: cancellationToken)) |
|
|
||
| #if !CODE_STYLE | ||
| private const uint DotDotTokenValueAssertion = -(DataKeyword - SyntaxKind.DataKeyword); | ||
| #endif |
There was a problem hiding this comment.
This is explained below. I forgot to rename the constant though. Will fix
| { | ||
| var precedingModifiers = context.PrecedingModifiers; | ||
| return !precedingModifiers.Contains(SyntaxKind.DataKeyword); | ||
| } |
There was a problem hiding this comment.
this entire method is tiny. i would just inline the entire thing.
There was a problem hiding this comment.
I tried to keep a similar structure to others. I'll adjust in a follow-up PR (want to get this in for demo bits)
The
datarecommender is similar to that forpublic.The
withrecommender is like the one foras.