SyntaxContext's GlobalStatementContext changes#59957
Conversation
| @@ -223,7 +223,7 @@ public static bool IsBeginningOfGlobalStatementContext(this SyntaxToken token) | |||
| return true; | |||
|
|
|||
| if (token.Parent is FileScopedNamespaceDeclarationSyntax namespaceDeclaration && namespaceDeclaration.SemicolonToken == token) | |||
There was a problem hiding this comment.
@CyrusNajmabadi is this line necessary at all?
There was a problem hiding this comment.
i have no idea. did anything break? :)
| if (token.Parent is FileScopedNamespaceDeclarationSyntax namespaceDeclaration && namespaceDeclaration.SemicolonToken == token) | ||
| return true; | ||
| return false; |
There was a problem hiding this comment.
Since this is changing to false, we can remove the condition completely, then the code will fallback to the return false; at the end of the method.
But first need to confirm if the new behavior of keyword recommenders is correct.
There was a problem hiding this comment.
Yep, I don't believe the 'new' keyword should be available directly after the file-scoped namespace declaration anyways. The check doesn't really seem to add anything.
Edit: the check is still needed because otherwise it gets to the next check and returns true, since FileScopedNamespaceDeclarationSyntax is a MemberDeclarationSyntax
#59931
1: Returns false instead of true if we recognize we're in a filescoped namespace
2: abstracts out the global statement context concept