-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Work some 'scoped' issues on IDE #65407
Conversation
b61dab7
to
f97b613
Compare
src/Features/CSharp/Portable/Completion/KeywordRecommenders/ScopedKeywordRecommender.cs
Outdated
Show resolved
Hide resolved
...ditorFeatures/CSharpTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.cs
Outdated
Show resolved
Hide resolved
@cston In reply to: 1314272868 |
...ditorFeatures/CSharpTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/Completion/KeywordRecommenders/GlobalKeywordRecommender.cs
Outdated
Show resolved
Hide resolved
@@ -36,7 +36,7 @@ private static bool IsInParameterModifierContext(int position, CSharpSyntaxConte | |||
if (context.SyntaxTree.IsParameterModifierContext( | |||
position, context.LeftToken, includeOperators: true, out var parameterIndex, out var previousModifier)) | |||
{ | |||
if (previousModifier == SyntaxKind.None) | |||
if (previousModifier is SyntaxKind.None or SyntaxKind.ScopedKeyword) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels odd. IsParameterModifierContext
should understand Scoped
itself right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CyrusNajmabadi I'm not sure what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, misread. sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you say this scoped
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes. this scoped
is valid. I'll add tests for this scoped
, this ref
, this in
, this scoped ref
, and this scoped in
.
src/Features/CSharp/Portable/Completion/KeywordRecommenders/OutKeywordRecommender.cs
Show resolved
Hide resolved
src/Features/CSharp/Portable/Completion/KeywordRecommenders/RefKeywordRecommender.cs
Show resolved
Hide resolved
In reply to: 1314281670 |
src/EditorFeatures/CSharpTest2/Recommendations/ScopedKeywordRecommenderTests.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/CSharpTest2/Recommendations/ScopedKeywordRecommenderTests.cs
Outdated
Show resolved
Hide resolved
I can look tomorrow. Thanks! |
src/EditorFeatures/CSharpTest/ReassignedVariable/CSharpReassignedVariableTests.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/Completion/KeywordRecommenders/GlobalKeywordRecommender.cs
Show resolved
Hide resolved
var previous = token.GetPreviousToken(includeSkipped: true); | ||
return previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var previous = token.GetPreviousToken(includeSkipped: true); | |
return previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword; | |
return token.Parent is ForStatementSyntax or CommonForEachStatementSyntax; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CyrusNajmabadi I'm following the same logic as in other keyword recommenders. I think if a change is needed here it should be in all recommenders?
{ | ||
parent = token.Parent.Parent; | ||
} | ||
else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel like there's somet repititino of these checks. but i don't feel strongly about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CyrusNajmabadi Could we leave the refactoring for a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned, I don't feel strongly about it. :-)
...haredUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs
Outdated
Show resolved
Hide resolved
await VerifyKeywordAsync(""" | ||
static class C | ||
{ | ||
static void M(this scoped $$) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out
isn't valid here, but I thought it's not a big deal to offer it for simplicity?
Merging latest main and re-triggering CI because #65262 might have an impact on the logic in this PR |
@CyrusNajmabadi Othan than flaky tests, everything appears to be passing. This can either be merged as is, or revised to make sure there are no dead checks after the parser changes. Unfortunately, I won't be able to validate now if there are dead checks or not. |
@CyrusNajmabadi Can you restart CI here? Thanks! |
Related to: #64906
Fixes #65403