625 references to IsKind
Microsoft.AspNetCore.App.Analyzers (13)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (12)
107
if (token.
IsKind
(SyntaxKind.QuestionToken) || token.
IsKind
(SyntaxKind.GreaterThanToken))
165
if (previous.
IsKind
(SyntaxKind.CommaToken) ||
166
previous.
IsKind
(SyntaxKind.OpenParenToken) ||
167
previous.
IsKind
(SyntaxKind.OutKeyword) ||
168
previous.
IsKind
(SyntaxKind.InKeyword) ||
169
previous.
IsKind
(SyntaxKind.RefKeyword) ||
170
previous.
IsKind
(SyntaxKind.ParamsKeyword) ||
171
(previous.
IsKind
(SyntaxKind.CloseBracketToken) && previous.GetRequiredParent().FirstAncestorOrSelf<AttributeListSyntax>() != null) ||
172
(previous.
IsKind
(SyntaxKind.LessThanToken) && previous.GetRequiredParent().FirstAncestorOrSelf<GenericNameSyntax>() != null))
290
return SyntaxFacts.IsPredefinedType(token.Kind()) || token.
IsKind
(SyntaxKind.IdentifierToken);
549
Debug.Assert(token.
IsKind
(SyntaxKind.StringLiteralToken));
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
401
Debug.Assert(token.
IsKind
(SyntaxKind.StringLiteralToken));
Microsoft.AspNetCore.App.Analyzers.Test (2)
Infrastructure\AmbiguousRoutePatternComparerTests.cs (1)
83
Assert.True(token.
IsKind
(SyntaxKind.StringLiteralToken));
RouteEmbeddedLanguage\RoutePatternParserTests.cs (1)
37
Assert.True(token.
IsKind
(SyntaxKind.StringLiteralToken));
Microsoft.AspNetCore.App.CodeFixes (2)
Dependencies\ExtensionMethodsCompletionProvider.cs (2)
114
var isIdentifierToken = token.
IsKind
(SyntaxKind.IdentifierName) || token.
IsKind
(SyntaxKind.IdentifierToken);
Microsoft.AspNetCore.Components.Analyzers (4)
ComponentParametersShouldBePublicCodeFixProvider.cs (4)
72
if (modifier.
IsKind
(SyntaxKind.PrivateKeyword) ||
73
modifier.
IsKind
(SyntaxKind.ProtectedKeyword) ||
74
modifier.
IsKind
(SyntaxKind.InternalKeyword) ||
77
modifier.
IsKind
(SyntaxKind.PublicKeyword))
Microsoft.AspNetCore.Components.SdkAnalyzers (4)
ComponentParametersShouldBePublicCodeFixProvider.cs (4)
72
if (modifier.
IsKind
(SyntaxKind.PrivateKeyword) ||
73
modifier.
IsKind
(SyntaxKind.ProtectedKeyword) ||
74
modifier.
IsKind
(SyntaxKind.InternalKeyword) ||
77
modifier.
IsKind
(SyntaxKind.PublicKeyword))
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
HubClientProxyGenerator.Parser.cs (1)
124
if (modifier.
IsKind
(SyntaxKind.PartialKeyword))
HubServerProxyGenerator.Parser.cs (1)
114
if (modifier.
IsKind
(SyntaxKind.PartialKeyword))
Microsoft.CodeAnalysis.CSharp (80)
Binder\Binder_Constraints.cs (1)
151
if (questionToken.
IsKind
(SyntaxKind.QuestionToken))
Compiler\DocumentationCommentCompiler.DocumentationCommentWalker.cs (1)
103
if (endGreaterThanToken.GetNextToken() is SyntaxToken newLineToken && newLineToken.
IsKind
(SyntaxKind.XmlTextLiteralNewLineToken))
CSharpExtensions.cs (1)
244
return token.
IsKind
(SyntaxKind.IdentifierToken) && token.Text.Length > 0 && token.Text[0] == '@';
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (1)
294
if (token.
IsKind
(SyntaxKind.IdentifierToken))
Symbols\Source\SourceMemberContainerSymbol.cs (1)
2825
foreach (var m in modifiers) { if (m.
IsKind
(modifier)) return true; };
Symbols\Source\SourceMemberFieldSymbol.cs (1)
198
if (modifier.
IsKind
(SyntaxKind.FixedKeyword))
Syntax\SyntaxFactory.cs (3)
1206
if (rewrittenToken.
IsKind
(SyntaxKind.LessThanToken) && string.Equals("<", rewrittenToken.Text, StringComparison.Ordinal))
1209
if (rewrittenToken.
IsKind
(SyntaxKind.GreaterThanToken) && string.Equals(">", rewrittenToken.Text, StringComparison.Ordinal))
2381
!token.
IsKind
(SyntaxKind.SemicolonToken))
Syntax\SyntaxNormalizer.cs (71)
174
return !token.
IsKind
(SyntaxKind.EndOfFileToken);
184
if (currentToken.
IsKind
(SyntaxKind.EndOfDirectiveToken))
200
if (nextToken.
IsKind
(SyntaxKind.CloseBraceToken))
235
if (nextToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
279
if ((nextToken.
IsKind
(SyntaxKind.FromKeyword) && nextToken.Parent.IsKind(SyntaxKind.FromClause)) ||
280
(nextToken.
IsKind
(SyntaxKind.LetKeyword) && nextToken.Parent.IsKind(SyntaxKind.LetClause)) ||
281
(nextToken.
IsKind
(SyntaxKind.WhereKeyword) && nextToken.Parent.IsKind(SyntaxKind.WhereClause)) ||
282
(nextToken.
IsKind
(SyntaxKind.JoinKeyword) && nextToken.Parent.IsKind(SyntaxKind.JoinClause)) ||
283
(nextToken.
IsKind
(SyntaxKind.JoinKeyword) && nextToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) ||
284
(nextToken.
IsKind
(SyntaxKind.OrderByKeyword) && nextToken.Parent.IsKind(SyntaxKind.OrderByClause)) ||
285
(nextToken.
IsKind
(SyntaxKind.SelectKeyword) && nextToken.Parent.IsKind(SyntaxKind.SelectClause)) ||
286
(nextToken.
IsKind
(SyntaxKind.GroupKeyword) && nextToken.Parent.IsKind(SyntaxKind.GroupClause)))
318
Debug.Assert(openBraceToken.
IsKind
(SyntaxKind.OpenBraceToken));
335
Debug.Assert(closeBraceToken.
IsKind
(SyntaxKind.CloseBraceToken));
411
=> currentToken.
IsKind
(SyntaxKind.CloseBraceToken) &&
483
var tokenIsOpenBrace = token.
IsKind
(SyntaxKind.OpenBraceToken);
484
var nextIsOpenBrace = next.
IsKind
(SyntaxKind.OpenBraceToken);
485
var tokenIsCloseBrace = token.
IsKind
(SyntaxKind.CloseBraceToken);
486
var nextIsCloseBrace = next.
IsKind
(SyntaxKind.CloseBraceToken);
543
var tokenIsOpenParen = token.
IsKind
(SyntaxKind.OpenParenToken);
544
var nextIsOpenParen = next.
IsKind
(SyntaxKind.OpenParenToken);
545
var tokenIsCloseParen = token.
IsKind
(SyntaxKind.CloseParenToken);
546
var nextIsCloseParen = next.
IsKind
(SyntaxKind.CloseParenToken);
600
if (next.
IsKind
(SyntaxKind.OpenBracketToken))
606
if (token.
IsKind
(SyntaxKind.OpenBracketToken))
626
return !next.
IsKind
(SyntaxKind.SemicolonToken);
649
if (token.
IsKind
(SyntaxKind.GreaterThanToken) && token.Parent.IsKind(SyntaxKind.TypeArgumentList))
657
if (token.
IsKind
(SyntaxKind.GreaterThanToken) &&
664
if (token.
IsKind
(SyntaxKind.CommaToken) &&
665
!next.
IsKind
(SyntaxKind.CommaToken) &&
677
if (next.
IsKind
(SyntaxKind.SwitchKeyword) && next.Parent is SwitchExpressionSyntax)
682
if (token.
IsKind
(SyntaxKind.QuestionToken))
693
if (token.
IsKind
(SyntaxKind.ColonToken))
699
if (next.
IsKind
(SyntaxKind.ColonToken))
709
if (token.
IsKind
(SyntaxKind.CloseBracketToken) && IsWord(next.Kind()))
715
if (token.
IsKind
(SyntaxKind.CloseParenToken) && IsWord(next.Kind()) && token.Parent.IsKind(SyntaxKind.TupleType) == true)
720
if ((next.
IsKind
(SyntaxKind.QuestionToken) || next.
IsKind
(SyntaxKind.ColonToken))
726
if (token.
IsKind
(SyntaxKind.EqualsToken))
731
if (next.
IsKind
(SyntaxKind.EqualsToken))
741
if (next.
IsKind
(SyntaxKind.AsteriskToken) && token.
IsKind
(SyntaxKind.DelegateKeyword))
747
if (token.
IsKind
(SyntaxKind.AsteriskToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerCallingConvention))
759
if (next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList) && next.
IsKind
(SyntaxKind.LessThanToken))
779
next.
IsKind
(SyntaxKind.OpenBracketToken))
787
if (next.
IsKind
(SyntaxKind.IdentifierToken))
789
if (token.
IsKind
(SyntaxKind.OpenBracketToken))
795
else if (token.
IsKind
(SyntaxKind.CommaToken))
803
if (next.
IsKind
(SyntaxKind.CommaToken))
810
if (next.
IsKind
(SyntaxKind.CloseBracketToken))
818
if (token.
IsKind
(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList))
825
if (next.
IsKind
(SyntaxKind.GreaterThanToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList))
830
if (token.
IsKind
(SyntaxKind.EqualsGreaterThanToken) || next.
IsKind
(SyntaxKind.EqualsGreaterThanToken))
842
if (next.
IsKind
(SyntaxKind.AsteriskToken) && next.Parent is PointerTypeSyntax)
848
if (token.
IsKind
(SyntaxKind.AsteriskToken) && token.Parent is PointerTypeSyntax &&
849
(next.
IsKind
(SyntaxKind.IdentifierToken) || next.Parent.IsKind(SyntaxKind.IndexerDeclaration)))
864
next.
IsKind
(SyntaxKind.OpenBraceToken))
870
token.
IsKind
(SyntaxKind.OpenBraceToken))
876
next.
IsKind
(SyntaxKind.CloseBraceToken))
891
if (!next.
IsKind
(SyntaxKind.ColonToken) &&
892
!next.
IsKind
(SyntaxKind.DotToken) &&
893
!next.
IsKind
(SyntaxKind.QuestionToken) &&
894
!next.
IsKind
(SyntaxKind.SemicolonToken) &&
895
!next.
IsKind
(SyntaxKind.OpenBracketToken) &&
896
(!next.
IsKind
(SyntaxKind.OpenParenToken) || KeywordNeedsSeparatorBeforeOpenParen(token.Kind()) || next.Parent.IsKind(SyntaxKind.TupleType)) &&
897
!next.
IsKind
(SyntaxKind.CloseParenToken) &&
898
!next.
IsKind
(SyntaxKind.CloseBraceToken) &&
899
!next.
IsKind
(SyntaxKind.ColonColonToken) &&
900
!next.
IsKind
(SyntaxKind.GreaterThanToken) &&
901
!next.
IsKind
(SyntaxKind.CommaToken))
Microsoft.CodeAnalysis.CSharp.CodeStyle (89)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (2)
99
if (!token.
IsKind
(SyntaxKind.CloseBraceToken))
103
if (!nextToken.
IsKind
(SyntaxKind.CloseBraceToken))
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (8)
122
if (!directive.TargetToken.
IsKind
(SyntaxKind.None))
130
if (directive.TargetToken.
IsKind
(SyntaxKind.AnnotationsKeyword))
134
else if (directive.TargetToken.
IsKind
(SyntaxKind.WarningsKeyword))
143
if (directive.SettingToken.
IsKind
(SyntaxKind.EnableKeyword))
147
else if (directive.SettingToken.
IsKind
(SyntaxKind.DisableKeyword))
157
if (directive.SettingToken.
IsKind
(SyntaxKind.EnableKeyword))
161
else if (directive.SettingToken.
IsKind
(SyntaxKind.DisableKeyword))
165
else if (directive.SettingToken.
IsKind
(SyntaxKind.RestoreKeyword))
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
236
if (element.Identifier.
IsKind
(SyntaxKind.None))
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
353
&& predefinedType.Keyword.
IsKind
(SyntaxKind.ObjectKeyword)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
50
=> token.
IsKind
(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (2)
94
(targetToken.
IsKind
(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) ||
549
if (token.
IsKind
(SyntaxKind.HashToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
206
isDisable = pragmaWarning.DisableOrRestoreKeyword.
IsKind
(SyntaxKind.DisableKeyword);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
15
predefinedType.Keyword.
IsKind
(SyntaxKind.VoidKeyword);
20
((IdentifierNameSyntax)typeSyntax).Identifier.
IsKind
(SyntaxKind.PartialKeyword);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
66
for (var currentToken = token1; !currentToken.
IsKind
(SyntaxKind.None);)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (8)
56
if (bracketOrBracePair.openBracketOrBrace.
IsKind
(SyntaxKind.None) ||
58
bracketOrBracePair.closeBracketOrBrace.
IsKind
(SyntaxKind.None))
63
if (bracketOrBracePair.openBracketOrBrace.
IsKind
(SyntaxKind.OpenBraceToken))
65
return bracketOrBracePair.closeBracketOrBrace.
IsKind
(SyntaxKind.CloseBraceToken);
68
if (bracketOrBracePair.openBracketOrBrace.
IsKind
(SyntaxKind.OpenBracketToken))
70
return bracketOrBracePair.closeBracketOrBrace.
IsKind
(SyntaxKind.CloseBracketToken);
277
return token.
IsKind
(SyntaxKind.EqualsToken) &&
538
return currentToken.
IsKind
(SyntaxKind.CommaToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (5)
115
currentToken.
IsKind
(SyntaxKind.WhereKeyword) &&
130
firstTokenAfterTypeConstraint.
IsKind
(SyntaxKind.WhereKeyword) &&
142
currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
293
if (previousToken.
IsKind
(SyntaxKind.CloseBracketToken) &&
340
if (!currentToken.
IsKind
(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (32)
83
if (previousToken.
IsKind
(SyntaxKind.CloseBraceToken)
84
&& currentToken.
IsKind
(SyntaxKind.ElseKeyword)
94
if (currentToken.
IsKind
(SyntaxKind.CatchKeyword))
103
if (currentToken.
IsKind
(SyntaxKind.FinallyKeyword))
112
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax)
121
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression))
130
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken))
168
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent is MemberDeclarationSyntax)
180
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax)
189
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression))
198
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement))
207
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
217
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression))
226
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent))
246
if (previousToken.
IsKind
(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression))
260
if (previousToken.
IsKind
(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression))
274
if (previousToken.
IsKind
(SyntaxKind.CloseBraceToken) && currentToken.
IsKind
(SyntaxKind.ElseKeyword))
288
if (currentToken.
IsKind
(SyntaxKind.CatchKeyword))
301
if (currentToken.
IsKind
(SyntaxKind.FinallyKeyword))
314
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax)
327
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression))
343
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
360
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
369
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent is MemberDeclarationSyntax)
386
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax)
399
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression))
412
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement))
425
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
439
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression))
452
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent))
467
if (previousToken.
IsKind
(SyntaxKind.SemicolonToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (2)
252
if (currentToken.
IsKind
(SyntaxKind.OpenBracketToken) &&
259
if (currentToken.
IsKind
(SyntaxKind.EndOfFileToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (3)
334
Debug.Assert(!startToken.
IsKind
(SyntaxKind.None) && !endToken.
IsKind
(SyntaxKind.None));
347
if (!pragmaWarningDirectiveTrivia.DisableOrRestoreKeyword.
IsKind
(disableOrRestoreKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (7)
89
if (!currentToken.
IsKind
(SyntaxKind.SemicolonToken) &&
287
if (previousToken.
IsKind
(SyntaxKind.CloseBracketToken) &&
291
if (currentToken.
IsKind
(SyntaxKind.OpenBracketToken))
374
if (currentToken.
IsKind
(SyntaxKind.OpenBracketToken) &&
393
if (currentToken.
IsKind
(SyntaxKind.ColonToken))
453
if (currentToken.
IsKind
(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression))
466
if (currentToken.
IsKind
(SyntaxKind.QuestionToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (4)
95
if (!firstToken.
IsKind
(SyntaxKind.None) || !lastToken.
IsKind
(SyntaxKind.None))
125
if (!tokens.firstToken.
IsKind
(SyntaxKind.None) || !tokens.lastToken.
IsKind
(SyntaxKind.None))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (4)
73
return endToken.
IsKind
(SyntaxKind.CloseBraceToken) &&
95
if (token.
IsKind
(SyntaxKind.OpenBraceToken) &&
100
if (nextToken.
IsKind
(SyntaxKind.CloseBraceToken))
109
if (token.
IsKind
(SyntaxKind.OpenBraceToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
346
return token.
IsKind
(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols();
358
if (token.
IsKind
(SyntaxKind.CommaToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
348
return previousToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (2)
61
var directive1IsUsingStatic = using1.StaticKeyword.
IsKind
(SyntaxKind.StaticKeyword);
62
var directive2IsUsingStatic = using2.StaticKeyword.
IsKind
(SyntaxKind.StaticKeyword);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (55)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
228
if (token.
IsKind
(SyntaxKind.HashToken) && token.Parent!.Kind() is not (SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia))
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
735
if (prevToken.
IsKind
(SyntaxKind.XmlTextLiteralNewLineToken))
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (2)
69
if (!token.
IsKind
(SyntaxKind.CloseBraceToken))
76
if (!firstBrace.
IsKind
(SyntaxKind.CloseBraceToken))
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
210
if (anonymousFunction.AsyncKeyword.
IsKind
(SyntaxKind.AsyncKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
461
ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, (SyntaxToken t) => t.
IsKind
(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
502
if (targetToken.
IsKind
(SyntaxKind.InKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (2)
25
if (token.
IsKind
(SyntaxKind.UsingKeyword))
47
if (token.
IsKind
(SyntaxKind.UnsafeKeyword) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (38)
165
if (token.
IsKind
(SyntaxKind.OpenBraceToken))
176
if (token.
IsKind
(SyntaxKind.SemicolonToken))
193
if (token.
IsKind
(SyntaxKind.CloseBraceToken))
219
if (token.
IsKind
(SyntaxKind.CloseBracketToken) &&
425
if (token.
IsKind
(SyntaxKind.None))
439
if (token.
IsKind
(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax)
454
if (token.
IsKind
(SyntaxKind.SemicolonToken))
476
if (token.
IsKind
(SyntaxKind.CloseBraceToken))
506
if (token.
IsKind
(SyntaxKind.CloseBracketToken) &&
850
if (token.
IsKind
(SyntaxKind.ColonToken) &&
851
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.IdentifierToken) &&
852
token.GetPreviousToken(includeSkipped: true).GetPreviousToken().
IsKind
(SyntaxKind.WhereKeyword))
876
if (token.
IsKind
(SyntaxKind.CommaToken) &&
1170
if (token.
IsKind
(SyntaxKind.DelegateKeyword) &&
1185
if (token.
IsKind
(SyntaxKind.OperatorKeyword) &&
1265
else if (token.
IsKind
(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter))
1269
else if (token.
IsKind
(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter))
1320
if (leftToken.
IsKind
(SyntaxKind.CloseParenToken))
1337
if (leftToken.
IsKind
(SyntaxKind.IdentifierToken))
1348
if (leftToken.
IsKind
(SyntaxKind.IdentifierToken) &&
1366
if (leftToken.
IsKind
(SyntaxKind.OpenParenToken))
1412
if (leftToken.
IsKind
(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern))
1420
if (leftToken.
IsKind
(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) &&
1438
if (leftToken.
IsKind
(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern))
1464
if (leftToken.
IsKind
(SyntaxKind.DotToken) ||
1465
leftToken.
IsKind
(SyntaxKind.MinusGreaterThanToken))
1526
binaryExpressionSyntax.OperatorToken.
IsKind
(SyntaxKind.IsKeyword) &&
1888
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
1889
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.FixedKeyword))
2048
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2340
tokenOnLeftOfPosition.
IsKind
(SyntaxKind.IdentifierToken))
2821
if (token.
IsKind
(SyntaxKind.NumericLiteralToken))
2864
if (token.
IsKind
(SyntaxKind.IdentifierToken) &&
2948
if (token.
IsKind
(SyntaxKind.CloseBraceToken))
2974
if (CodeAnalysis.CSharpExtensions.
IsKind
(token, SyntaxKind.CatchKeyword))
2979
if (CodeAnalysis.CSharpExtensions.
IsKind
(token, SyntaxKind.CloseParenToken) &&
2995
targetToken.
IsKind
(SyntaxKind.ColonToken) &&
3057
return targetToken.
IsKind
(SyntaxKind.AsteriskToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
101
if (reference.GetSyntax().ChildTokens().Any(t => t.
IsKind
(SyntaxKind.UnsafeKeyword)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (2)
100
if (token.IsMissing || token.
IsKind
(SyntaxKind.None))
118
if (addedBraces && typeDeclaration.SemicolonToken.
IsKind
(SyntaxKind.SemicolonToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (1)
80
if (token.
IsKind
(SyntaxKind.None) ||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (2)
84
if (token.
IsKind
(SyntaxKind.MultiLineRawStringLiteralToken))
179
(token.
IsKind
(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
342
if (previousToken.
IsKind
(SyntaxKind.CommaToken))
1968
if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.
IsKind
(SyntaxKind.BreakKeyword)))
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
629
if (syntaxToken.IsMissing || syntaxToken.
IsKind
(SyntaxKind.None))
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (1)
383
if (nextToken.
IsKind
(SyntaxKind.SemicolonToken)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (1)
3418
if (position == endToken.SpanStart && !endToken.GetPreviousToken().
IsKind
(SyntaxKind.None))
Microsoft.CodeAnalysis.CSharp.Features (107)
BraceCompletion\BracketBraceCompletionService.cs (3)
31
protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.
IsKind
(SyntaxKind.OpenBracketToken);
33
protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.
IsKind
(SyntaxKind.CloseBracketToken);
49
if (currentToken.
IsKind
(SyntaxKind.OpenBracketToken) && currentToken.Parent.IsKind(SyntaxKind.ListPattern))
BraceCompletion\CharLiteralBraceCompletionService.cs (2)
25
protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.
IsKind
(SyntaxKind.CharacterLiteralToken);
27
protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.
IsKind
(SyntaxKind.CharacterLiteralToken);
BraceCompletion\CurlyBraceCompletionService.cs (3)
48
=> token.
IsKind
(SyntaxKind.OpenBraceToken) && !token.Parent.IsKind(SyntaxKind.Interpolation);
51
=> token.
IsKind
(SyntaxKind.CloseBraceToken);
126
if (!currentToken.
IsKind
(SyntaxKind.OpenBraceToken))
BraceCompletion\InterpolatedStringBraceCompletionService.cs (1)
40
=> rightToken.
IsKind
(SyntaxKind.InterpolatedStringEndToken);
BraceCompletion\InterpolationBraceCompletionService.cs (2)
42
=> token.
IsKind
(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation);
45
=> token.
IsKind
(SyntaxKind.CloseBraceToken);
BraceCompletion\LessAndGreaterThanBraceCompletionService.cs (2)
32
=> token.
IsKind
(SyntaxKind.LessThanToken);
35
=> token.
IsKind
(SyntaxKind.GreaterThanToken);
BraceCompletion\ParenthesisBraceCompletionService.cs (2)
26
protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.
IsKind
(SyntaxKind.OpenParenToken);
28
protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.
IsKind
(SyntaxKind.CloseParenToken);
BraceCompletion\StringLiteralBraceCompletionService.cs (4)
50
protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.
IsKind
(SyntaxKind.StringLiteralToken);
52
protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.
IsKind
(SyntaxKind.StringLiteralToken);
72
if (token.
IsKind
(SyntaxKind.StringLiteralToken) &&
95
while (!token.
IsKind
(SyntaxKind.None) && !token.TrailingTrivia.Contains(t => t.IsEndOfLine()))
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (12)
100
if (firstToken.
IsKind
(SyntaxKind.None))
121
if (firstNonDirectiveToken.
IsKind
(SyntaxKind.None) && firstDirective is null)
138
if (originalNode.SettingToken.
IsKind
(SyntaxKind.DisableKeyword))
144
if (originalNode.SettingToken.
IsKind
(SyntaxKind.RestoreKeyword))
149
if (originalNode.SettingToken.
IsKind
(SyntaxKind.EnableKeyword))
176
else if (leadingDirective.SettingToken.
IsKind
(SyntaxKind.RestoreKeyword) && leadingDirective.TargetToken.
IsKind
(SyntaxKind.None))
220
if (firstToken.
IsKind
(SyntaxKind.None))
225
if (firstToken.
IsKind
(SyntaxKind.HashToken) && firstToken.Parent.IsKind(SyntaxKind.RegionDirectiveTrivia))
230
if (nextToken.
IsKind
(SyntaxKind.HashToken) && nextToken.Parent.IsKind(SyntaxKind.EndRegionDirectiveTrivia))
245
&& nullableDirective.TargetToken.
IsKind
(SyntaxKind.None))
248
if (firstSemanticToken.
IsKind
(SyntaxKind.None) || firstSemanticToken.SpanStart > nullableDirective.Span.End)
Completion\CompletionProviders\CrefCompletionProvider.cs (4)
140
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
146
if (token.
IsKind
(SyntaxKind.OpenBracketToken) &&
160
return token.
IsKind
(SyntaxKind.DotToken)
287
if (symbol is INamespaceOrTypeSymbol && token.
IsKind
(SyntaxKind.DotToken))
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (1)
113
if (token.
IsKind
(SyntaxKind.NewKeyword) && token.Parent.IsKind(SyntaxKind.ObjectCreationExpression))
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (6)
138
if (token.
IsKind
(SyntaxKind.IdentifierToken) &&
226
if (!IsPossibleTypeToken(token) && !token.
IsKind
(SyntaxKind.CommaToken))
237
if (token.
IsKind
(SyntaxKind.CommaToken) && token.Parent != target)
248
if (!token.
IsKind
(SyntaxKind.CommaToken) && token != typeSyntax.GetLastToken())
346
var possibleDeclarationComputer = token.
IsKind
(SyntaxKind.CommaToken)
366
if (token.
IsKind
(SyntaxKind.QuestionToken) &&
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (1)
78
if (targetToken.
IsKind
(SyntaxKind.GreaterThanToken) && potentialTypeNode is TypeArgumentListSyntax typeArgumentList)
Completion\CompletionProviders\ImportCompletion\ExtensionMethodImportCompletionProvider.cs (1)
40
if (token.
IsKind
(SyntaxKind.None) || token.IsMissing)
Completion\CompletionProviders\ImportCompletion\TypeImportCompletionProvider.cs (1)
40
if (token.
IsKind
(SyntaxKind.None) || token.IsMissing)
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (2)
135
return !syntaxToken.
IsKind
(SyntaxKind.None)
136
&& !touchingToken.
IsKind
(SyntaxKind.None)
Completion\CompletionProviders\TupleNameCompletionProvider.cs (2)
75
if (token.
IsKind
(SyntaxKind.OpenParenToken))
83
if (token.
IsKind
(SyntaxKind.CommaToken) && token.Parent is TupleExpressionSyntax tupleExpr)
Completion\CompletionProviders\XmlDocCommentCompletionProvider.cs (3)
215
if (token.
IsKind
(SyntaxKind.XmlTextLiteralToken) && string.IsNullOrWhiteSpace(token.Text))
231
if (token.
IsKind
(SyntaxKind.IdentifierToken) && token.Parent.IsKind(SyntaxKind.XmlName))
299
else if (token.
IsKind
(SyntaxKind.XmlTextLiteralToken) &&
Completion\KeywordRecommenders\WhereKeywordRecommender.cs (1)
107
if (token.
IsKind
(SyntaxKind.DotToken))
Debugging\BreakpointResolver.cs (1)
73
if (token.
IsKind
(SyntaxKind.SemicolonToken))
Debugging\DataTipInfoGetter.cs (1)
35
return token.
IsKind
(SyntaxKind.IdentifierToken)
EditAndContinue\BreakpointSpans.cs (1)
770
=> token2.
IsKind
(SyntaxKind.None) || token2.IsMissing ? token1 : token2;
EditAndContinue\SyntaxComparer.cs (4)
840
if (leftUsing.GlobalKeyword.
IsKind
(SyntaxKind.None) != rightUsing.GlobalKeyword.
IsKind
(SyntaxKind.None))
844
if (leftUsing.UnsafeKeyword.
IsKind
(SyntaxKind.None) != rightUsing.UnsafeKeyword.
IsKind
(SyntaxKind.None))
EditAndContinue\SyntaxUtilities.cs (1)
211
return anonymousFunction.AsyncKeyword.
IsKind
(SyntaxKind.AsyncKeyword);
GenerateType\CSharpGenerateTypeService.cs (5)
231
!token.
IsKind
(SyntaxKind.DotToken))
247
if (token.
IsKind
(SyntaxKind.DotToken) &&
267
nextToken.
IsKind
(SyntaxKind.DotToken))
285
if (nextToken.
IsKind
(SyntaxKind.DotToken))
317
if (nextToken.
IsKind
(SyntaxKind.DotToken))
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
42
if (token.GetPreviousToken().
IsKind
(SyntaxKind.YieldKeyword))
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (1)
75
var end = !gotoStatement.CaseOrDefaultKeyword.
IsKind
(SyntaxKind.None)
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (1)
55
=> token.
IsKind
(SyntaxKind.EndOfDirectiveToken)
QuickInfo\CSharpSemanticQuickInfoProvider.cs (3)
38
if (token.
IsKind
(SyntaxKind.EqualsGreaterThanToken)
45
else if (token.
IsKind
(SyntaxKind.DelegateKeyword) && token.Parent.IsKind(SyntaxKind.AnonymousMethodExpression))
71
if (token.
IsKind
(SyntaxKind.DotToken) &&
SignatureHelp\AttributeSignatureHelpProvider.cs (1)
60
return !token.
IsKind
(SyntaxKind.None) &&
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (3)
286
return !token.
IsKind
(SyntaxKind.None) &&
335
return !token.
IsKind
(SyntaxKind.None) &&
370
return !token.
IsKind
(SyntaxKind.None) &&
SignatureHelp\GenericNameSignatureHelpProvider.cs (1)
63
return !token.
IsKind
(SyntaxKind.None) &&
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (1)
48
=> !token.
IsKind
(SyntaxKind.None) &&
SignatureHelp\SignatureHelpUtilities.cs (3)
103
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
130
if (token.
IsKind
(SyntaxKind.CommaToken) && token.Parent is TupleExpressionSyntax && token.GetAncestor<TSyntaxNode>() != null)
135
return !token.
IsKind
(SyntaxKind.None) &&
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (1)
227
=> token.
IsKind
(SyntaxKind.OpenParenToken) && token.Parent is ParenthesizedExpressionSyntax;
SplitStringLiteral\SimpleStringSplitter.cs (1)
33
return _token.
IsKind
(SyntaxKind.Utf8StringLiteralToken) && CursorPosition >= _token.Span.End - "u8".Length;
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (2)
99
if (!token.
IsKind
(SyntaxKind.CloseBraceToken))
103
if (!nextToken.
IsKind
(SyntaxKind.CloseBraceToken))
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (8)
122
if (!directive.TargetToken.
IsKind
(SyntaxKind.None))
130
if (directive.TargetToken.
IsKind
(SyntaxKind.AnnotationsKeyword))
134
else if (directive.TargetToken.
IsKind
(SyntaxKind.WarningsKeyword))
143
if (directive.SettingToken.
IsKind
(SyntaxKind.EnableKeyword))
147
else if (directive.SettingToken.
IsKind
(SyntaxKind.DisableKeyword))
157
if (directive.SettingToken.
IsKind
(SyntaxKind.EnableKeyword))
161
else if (directive.SettingToken.
IsKind
(SyntaxKind.DisableKeyword))
165
else if (directive.SettingToken.
IsKind
(SyntaxKind.RestoreKeyword))
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
236
if (element.Identifier.
IsKind
(SyntaxKind.None))
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
353
&& predefinedType.Keyword.
IsKind
(SyntaxKind.ObjectKeyword)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
228
if (token.
IsKind
(SyntaxKind.HashToken) && token.Parent!.Kind() is not (SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia))
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
735
if (prevToken.
IsKind
(SyntaxKind.XmlTextLiteralNewLineToken))
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (2)
69
if (!token.
IsKind
(SyntaxKind.CloseBraceToken))
76
if (!firstBrace.
IsKind
(SyntaxKind.CloseBraceToken))
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
210
if (anonymousFunction.AsyncKeyword.
IsKind
(SyntaxKind.AsyncKeyword))
Structure\CSharpStructureHelpers.cs (2)
237
if (startToken.
IsKind
(SyntaxKind.None) || endToken.
IsKind
(SyntaxKind.None))
Structure\Providers\BlockSyntaxStructureProvider.cs (1)
166
if (previousToken.
IsKind
(SyntaxKind.None))
UseAutoProperty\SingleLinePropertyFormattingRule.cs (4)
16
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList))
19
if (previousToken.
IsKind
(SyntaxKind.OpenBraceToken) && previousToken.Parent.IsKind(SyntaxKind.AccessorList))
22
if (currentToken.
IsKind
(SyntaxKind.CloseBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList))
25
if (previousToken.
IsKind
(SyntaxKind.SemicolonToken) && currentToken.Parent is AccessorDeclarationSyntax)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\UnsafeTests.cs (2)
8345
foreach (var nullSyntax in tree.GetCompilationUnitRoot().DescendantTokens().Where(token => token.
IsKind
(SyntaxKind.NullKeyword)))
8381
foreach (var declarationSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>().Where(syntax => syntax.GetFirstToken().
IsKind
(SyntaxKind.VoidKeyword)))
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (4)
Syntax\SyntaxAnnotationTests.cs (3)
693
if (!token.
IsKind
(SyntaxKind.None))
734
if (token.
IsKind
(SyntaxKind.None))
834
if (token.
IsKind
(SyntaxKind.None))
Syntax\SyntaxNodeTests.cs (1)
2241
var tokens = expr.DescendantTokens().Where(t => t.
IsKind
(SyntaxKind.IdentifierToken)).ToList();
Microsoft.CodeAnalysis.CSharp.Workspaces (218)
Classification\ClassificationHelpers.cs (3)
34
else if (SyntaxFacts.IsKeywordKind(token.Kind()) || token.
IsKind
(SyntaxKind.DiscardDesignation))
177
&& interpolatedString.StringStartToken.
IsKind
(SyntaxKind.InterpolatedVerbatimStringStartToken);
188
&& interpolatedString.StringStartToken.
IsKind
(SyntaxKind.InterpolatedVerbatimStringStartToken);
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
138
name.Identifier.
IsKind
(SyntaxKind.GlobalKeyword);
CodeGeneration\CSharpSyntaxGenerator.cs (2)
1027
=> list.Target?.Identifier.
IsKind
(SyntaxKind.ReturnKeyword) ?? false;
1999
=> type is PredefinedTypeSyntax pd && pd.Keyword.
IsKind
(SyntaxKind.VoidKeyword) ? null : type;
Formatting\CSharpSyntaxFormattingService.cs (3)
130
(token.
IsKind
(SyntaxKind.CloseBraceToken) && OnlySmartIndentCloseBrace(indentationOptions.AutoFormattingOptions)) ||
131
(token.
IsKind
(SyntaxKind.OpenBraceToken) && OnlySmartIndentOpenBrace(indentationOptions.AutoFormattingOptions));
288
if (endToken.
IsKind
(SyntaxKind.OpenBraceToken))
Rename\CSharpRenameRewriterLanguageService.cs (11)
261
=> token.
IsKind
(SyntaxKind.GetKeyword)
265
=> token.
IsKind
(SyntaxKind.SetKeyword)
269
=> token.
IsKind
(SyntaxKind.InitKeyword)
280
token.
IsKind
(SyntaxKind.IdentifierToken) &&
380
if (!isRenameLocation && symbol is INamespaceSymbol && token.GetPreviousToken().
IsKind
(SyntaxKind.NamespaceKeyword))
399
if (isRenameLocation && token.GetPreviousToken().
IsKind
(SyntaxKind.NamespaceKeyword))
543
!token.
IsKind
(SyntaxKind.GlobalKeyword) &&
695
if (newToken.
IsKind
(SyntaxKind.StringLiteralToken))
699
else if (newToken.
IsKind
(SyntaxKind.InterpolatedStringTextToken))
708
if (newToken.
IsKind
(SyntaxKind.XmlTextLiteralToken))
712
else if (newToken.
IsKind
(SyntaxKind.IdentifierToken) && newToken.Parent.IsKind(SyntaxKind.XmlName) && newToken.ValueText == _originalText)
Simplification\CSharpSimplificationService.NodesAndTokensToReduceComputer.cs (1)
106
if (_simplifyAllDescendants && !_insideSpeculatedNode && !token.
IsKind
(SyntaxKind.None))
Simplification\Simplifiers\NameSimplifier.cs (1)
712
aliasName.Alias.Identifier.
IsKind
(SyntaxKind.GlobalKeyword);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
50
=> token.
IsKind
(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (2)
94
(targetToken.
IsKind
(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) ||
549
if (token.
IsKind
(SyntaxKind.HashToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
206
isDisable = pragmaWarning.DisableOrRestoreKeyword.
IsKind
(SyntaxKind.DisableKeyword);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
15
predefinedType.Keyword.
IsKind
(SyntaxKind.VoidKeyword);
20
((IdentifierNameSyntax)typeSyntax).Identifier.
IsKind
(SyntaxKind.PartialKeyword);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
66
for (var currentToken = token1; !currentToken.
IsKind
(SyntaxKind.None);)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (8)
56
if (bracketOrBracePair.openBracketOrBrace.
IsKind
(SyntaxKind.None) ||
58
bracketOrBracePair.closeBracketOrBrace.
IsKind
(SyntaxKind.None))
63
if (bracketOrBracePair.openBracketOrBrace.
IsKind
(SyntaxKind.OpenBraceToken))
65
return bracketOrBracePair.closeBracketOrBrace.
IsKind
(SyntaxKind.CloseBraceToken);
68
if (bracketOrBracePair.openBracketOrBrace.
IsKind
(SyntaxKind.OpenBracketToken))
70
return bracketOrBracePair.closeBracketOrBrace.
IsKind
(SyntaxKind.CloseBracketToken);
277
return token.
IsKind
(SyntaxKind.EqualsToken) &&
538
return currentToken.
IsKind
(SyntaxKind.CommaToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (5)
115
currentToken.
IsKind
(SyntaxKind.WhereKeyword) &&
130
firstTokenAfterTypeConstraint.
IsKind
(SyntaxKind.WhereKeyword) &&
142
currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
293
if (previousToken.
IsKind
(SyntaxKind.CloseBracketToken) &&
340
if (!currentToken.
IsKind
(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (32)
83
if (previousToken.
IsKind
(SyntaxKind.CloseBraceToken)
84
&& currentToken.
IsKind
(SyntaxKind.ElseKeyword)
94
if (currentToken.
IsKind
(SyntaxKind.CatchKeyword))
103
if (currentToken.
IsKind
(SyntaxKind.FinallyKeyword))
112
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax)
121
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression))
130
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken))
168
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent is MemberDeclarationSyntax)
180
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax)
189
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression))
198
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement))
207
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
217
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression))
226
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent))
246
if (previousToken.
IsKind
(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression))
260
if (previousToken.
IsKind
(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression))
274
if (previousToken.
IsKind
(SyntaxKind.CloseBraceToken) && currentToken.
IsKind
(SyntaxKind.ElseKeyword))
288
if (currentToken.
IsKind
(SyntaxKind.CatchKeyword))
301
if (currentToken.
IsKind
(SyntaxKind.FinallyKeyword))
314
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax)
327
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression))
343
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
360
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
369
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent is MemberDeclarationSyntax)
386
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax)
399
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression))
412
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement))
425
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
439
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression))
452
if (currentToken.
IsKind
(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent))
467
if (previousToken.
IsKind
(SyntaxKind.SemicolonToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (2)
252
if (currentToken.
IsKind
(SyntaxKind.OpenBracketToken) &&
259
if (currentToken.
IsKind
(SyntaxKind.EndOfFileToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (3)
334
Debug.Assert(!startToken.
IsKind
(SyntaxKind.None) && !endToken.
IsKind
(SyntaxKind.None));
347
if (!pragmaWarningDirectiveTrivia.DisableOrRestoreKeyword.
IsKind
(disableOrRestoreKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (7)
89
if (!currentToken.
IsKind
(SyntaxKind.SemicolonToken) &&
287
if (previousToken.
IsKind
(SyntaxKind.CloseBracketToken) &&
291
if (currentToken.
IsKind
(SyntaxKind.OpenBracketToken))
374
if (currentToken.
IsKind
(SyntaxKind.OpenBracketToken) &&
393
if (currentToken.
IsKind
(SyntaxKind.ColonToken))
453
if (currentToken.
IsKind
(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression))
466
if (currentToken.
IsKind
(SyntaxKind.QuestionToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (4)
95
if (!firstToken.
IsKind
(SyntaxKind.None) || !lastToken.
IsKind
(SyntaxKind.None))
125
if (!tokens.firstToken.
IsKind
(SyntaxKind.None) || !tokens.lastToken.
IsKind
(SyntaxKind.None))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (4)
73
return endToken.
IsKind
(SyntaxKind.CloseBraceToken) &&
95
if (token.
IsKind
(SyntaxKind.OpenBraceToken) &&
100
if (nextToken.
IsKind
(SyntaxKind.CloseBraceToken))
109
if (token.
IsKind
(SyntaxKind.OpenBraceToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
346
return token.
IsKind
(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols();
358
if (token.
IsKind
(SyntaxKind.CommaToken))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
348
return previousToken.
IsKind
(SyntaxKind.OpenBraceToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (2)
61
var directive1IsUsingStatic = using1.StaticKeyword.
IsKind
(SyntaxKind.StaticKeyword);
62
var directive2IsUsingStatic = using2.StaticKeyword.
IsKind
(SyntaxKind.StaticKeyword);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
461
ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, (SyntaxToken t) => t.
IsKind
(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (5)
229
var isDestructorTypeContext = targetToken.
IsKind
(SyntaxKind.TildeToken) &&
351
if (!previousToken.
IsKind
(SyntaxKind.RecordKeyword))
454
if (targetToken.
IsKind
(SyntaxKind.AwaitKeyword))
465
&& targetToken.
IsKind
(SyntaxKind.IdentifierToken)
502
if (targetToken.
IsKind
(SyntaxKind.InKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (2)
25
if (token.
IsKind
(SyntaxKind.UsingKeyword))
47
if (token.
IsKind
(SyntaxKind.UnsafeKeyword) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (103)
94
if (token.
IsKind
(SyntaxKind.CloseBracketToken)
165
if (token.
IsKind
(SyntaxKind.OpenBraceToken))
176
if (token.
IsKind
(SyntaxKind.SemicolonToken))
193
if (token.
IsKind
(SyntaxKind.CloseBraceToken))
219
if (token.
IsKind
(SyntaxKind.CloseBracketToken) &&
425
if (token.
IsKind
(SyntaxKind.None))
439
if (token.
IsKind
(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax)
454
if (token.
IsKind
(SyntaxKind.SemicolonToken))
476
if (token.
IsKind
(SyntaxKind.CloseBraceToken))
506
if (token.
IsKind
(SyntaxKind.CloseBracketToken) &&
630
if (token.
IsKind
(SyntaxKind.ColonColonToken) &&
631
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.GlobalKeyword))
643
if (token.
IsKind
(SyntaxKind.UsingKeyword))
696
token.GetPreviousToken().
IsKind
(SyntaxKind.PartialKeyword))
850
if (token.
IsKind
(SyntaxKind.ColonToken) &&
851
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.IdentifierToken) &&
852
token.GetPreviousToken(includeSkipped: true).GetPreviousToken().
IsKind
(SyntaxKind.WhereKeyword))
876
if (token.
IsKind
(SyntaxKind.CommaToken) &&
895
if (token.
IsKind
(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression))
907
if (token.
IsKind
(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression))
920
if (token.
IsKind
(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression))
1063
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
1071
if (token.
IsKind
(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList))
1077
if (token.
IsKind
(SyntaxKind.CommaToken) &&
1087
if (token.
IsKind
(SyntaxKind.CommaToken) &&
1096
if (token.
IsKind
(SyntaxKind.CloseBracketToken) &&
1112
else if (token.
IsKind
(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName)
1170
if (token.
IsKind
(SyntaxKind.DelegateKeyword) &&
1185
if (token.
IsKind
(SyntaxKind.OperatorKeyword) &&
1265
else if (token.
IsKind
(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter))
1269
else if (token.
IsKind
(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter))
1320
if (leftToken.
IsKind
(SyntaxKind.CloseParenToken))
1337
if (leftToken.
IsKind
(SyntaxKind.IdentifierToken))
1348
if (leftToken.
IsKind
(SyntaxKind.IdentifierToken) &&
1366
if (leftToken.
IsKind
(SyntaxKind.OpenParenToken))
1412
if (leftToken.
IsKind
(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern))
1420
if (leftToken.
IsKind
(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) &&
1438
if (leftToken.
IsKind
(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern))
1464
if (leftToken.
IsKind
(SyntaxKind.DotToken) ||
1465
leftToken.
IsKind
(SyntaxKind.MinusGreaterThanToken))
1526
binaryExpressionSyntax.OperatorToken.
IsKind
(SyntaxKind.IsKeyword) &&
1785
if (token.
IsKind
(SyntaxKind.ConstKeyword) &&
1817
if (token.
IsKind
(SyntaxKind.OutKeyword) &&
1829
if (token.
IsKind
(SyntaxKind.OpenParenToken))
1838
if (token.
IsKind
(SyntaxKind.UsingKeyword) &&
1853
if (CodeAnalysis.CSharpExtensions.
IsKind
(token, SyntaxKind.JoinKeyword) &&
1865
if (token.
IsKind
(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax)
1871
if (token.
IsKind
(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax)
1888
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
1889
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.FixedKeyword))
1930
if (token.
IsKind
(SyntaxKind.NewKeyword))
1984
if (token.
IsKind
(SyntaxKind.None))
2034
if (CodeAnalysis.CSharpExtensions.
IsKind
(token, SyntaxKind.OpenParenToken) &&
2048
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2068
if (token.
IsKind
(SyntaxKind.CaseKeyword) &&
2074
if (token.
IsKind
(SyntaxKind.EqualsToken) &&
2117
if (token.
IsKind
(SyntaxKind.ColonToken) &&
2125
if (token.
IsKind
(SyntaxKind.EqualsToken) &&
2206
if (token.
IsKind
(SyntaxKind.EqualsToken))
2248
if (token.
IsKind
(SyntaxKind.OpenParenToken))
2323
if (token.
IsKind
(SyntaxKind.AsteriskToken) && semanticModel != null)
2340
tokenOnLeftOfPosition.
IsKind
(SyntaxKind.IdentifierToken))
2374
if (token.
IsKind
(SyntaxKind.DotDotToken) &&
2382
if (token.
IsKind
(SyntaxKind.QuestionToken) &&
2391
if (token.
IsKind
(SyntaxKind.ColonToken) &&
2400
if (token.
IsKind
(SyntaxKind.OpenParenToken))
2465
if (token.
IsKind
(SyntaxKind.ColonToken) &&
2473
if (token.
IsKind
(SyntaxKind.EqualsGreaterThanToken))
2486
if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.
IsKind
(SyntaxKind.OpenBraceToken))
2489
if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().
IsKind
(SyntaxKind.EqualsToken))
2516
if (token.
IsKind
(SyntaxKind.SemicolonToken) &&
2527
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2536
if (token.
IsKind
(SyntaxKind.CommaToken) &&
2546
if (token.
IsKind
(SyntaxKind.InKeyword))
2567
if (token.
IsKind
(SyntaxKind.WhereKeyword) &&
2582
if (token.
IsKind
(SyntaxKind.SelectKeyword) &&
2599
if (token.
IsKind
(SyntaxKind.ReturnKeyword))
2608
if (token.
IsKind
(SyntaxKind.ThrowKeyword))
2614
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2615
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.WhileKeyword))
2624
if (token.
IsKind
(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement))
2630
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2631
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.LockKeyword))
2637
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2638
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.IfKeyword))
2644
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2645
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.SwitchKeyword))
2651
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2652
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.CheckedKeyword))
2658
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2659
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.UncheckedKeyword))
2665
if (token.
IsKind
(SyntaxKind.OpenParenToken) &&
2666
token.GetPreviousToken(includeSkipped: true).
IsKind
(SyntaxKind.WhenKeyword))
2672
if (token.
IsKind
(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause))
2728
if (token.
IsKind
(SyntaxKind.OpenBraceToken))
2821
if (token.
IsKind
(SyntaxKind.NumericLiteralToken))
2864
if (token.
IsKind
(SyntaxKind.IdentifierToken) &&
2948
if (token.
IsKind
(SyntaxKind.CloseBraceToken))
2974
if (CodeAnalysis.CSharpExtensions.
IsKind
(token, SyntaxKind.CatchKeyword))
2979
if (CodeAnalysis.CSharpExtensions.
IsKind
(token, SyntaxKind.CloseParenToken) &&
2995
targetToken.
IsKind
(SyntaxKind.ColonToken) &&
3006
if (!token.
IsKind
(SyntaxKind.DotToken))
3057
return targetToken.
IsKind
(SyntaxKind.AsteriskToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
101
if (reference.GetSyntax().ChildTokens().Any(t => t.
IsKind
(SyntaxKind.UnsafeKeyword)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (2)
100
if (token.IsMissing || token.
IsKind
(SyntaxKind.None))
118
if (addedBraces && typeDeclaration.SemicolonToken.
IsKind
(SyntaxKind.SemicolonToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (1)
80
if (token.
IsKind
(SyntaxKind.None) ||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (2)
84
if (token.
IsKind
(SyntaxKind.MultiLineRawStringLiteralToken))
179
(token.
IsKind
(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
342
if (previousToken.
IsKind
(SyntaxKind.CommaToken))
1968
if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.
IsKind
(SyntaxKind.BreakKeyword)))
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
Formatting\FormattingTriviaTests.cs (1)
1787
.Where(tr => tr.
IsKind
(SyntaxKind.EndOfDirectiveToken)), (o, r) => o.WithTrailingTrivia(o.LeadingTrivia.Add(SyntaxFactory.ElasticEndOfLine(newLine)))
Microsoft.Extensions.Logging.Generators (3)
LoggerMessageGenerator.Parser.cs (2)
286
if (mod.
IsKind
(SyntaxKind.PartialKeyword))
290
else if (mod.
IsKind
(SyntaxKind.StaticKeyword))
src\libraries\Common\src\Roslyn\CSharpSyntaxHelper.cs (1)
120
if (directive.GlobalKeyword.
IsKind
(SyntaxKind.GlobalKeyword) &&
Microsoft.Extensions.Options.SourceGeneration (1)
ParserUtilities.cs (1)
38
syntax.Modifiers.Any(m => m.
IsKind
(modifierToSearch)));
Microsoft.Gen.ContextualOptions (3)
Parser.cs (3)
31
.Where(modifier => modifier.
IsKind
(SyntaxKind.StaticKeyword))
45
.Where(modifier => modifier.
IsKind
(SyntaxKind.RefKeyword))
54
if (!type.Definitions.Any(def => def.Modifiers.Any(static token => token.
IsKind
(SyntaxKind.PartialKeyword))))
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
EmitterTests.cs (1)
39
mod => mod.
IsKind
(SyntaxKind.ReadOnlyKeyword));
Microsoft.Gen.Logging (1)
src\Generators\Shared\ParserUtilities.cs (1)
43
syntax.Modifiers.Any(m => m.
IsKind
(modifierToSearch)));
Microsoft.Gen.Metrics (1)
src\Generators\Shared\ParserUtilities.cs (1)
43
syntax.Modifiers.Any(m => m.
IsKind
(modifierToSearch)));
Microsoft.Gen.MetricsReports (1)
src\Generators\Shared\ParserUtilities.cs (1)
43
syntax.Modifiers.Any(m => m.
IsKind
(modifierToSearch)));
Microsoft.Interop.ComInterfaceGenerator (1)
ComInterfaceGenerator.cs (1)
369
var methodSyntaxTemplate = new ContainingSyntax(new SyntaxTokenList(syntax.Modifiers.Where(static m => !m.
IsKind
(SyntaxKind.NewKeyword))).StripAccessibilityModifiers(), SyntaxKind.MethodDeclaration, syntax.Identifier, syntax.TypeParameterList);
Microsoft.Interop.SourceGeneration (1)
Marshalling\StaticPinnableManagedValueMarshaller.cs (1)
31
&& predefinedType.Keyword.
IsKind
(SyntaxKind.VoidKeyword))
Microsoft.ML.InternalCodeAnalyzer (5)
NameAnalyzer.cs (5)
131
return modifiers.Any(token => token.
IsKind
(SyntaxKind.ExternKeyword));
151
if (mod.
IsKind
(SyntaxKind.ConstKeyword))
153
else if (mod.
IsKind
(SyntaxKind.PublicKeyword) || mod.
IsKind
(SyntaxKind.ProtectedKeyword) || mod.
IsKind
(SyntaxKind.InternalKeyword))
Microsoft.VisualStudio.LanguageServices.CSharp (19)
LanguageService\CSharpHelpContextService.cs (19)
131
if (token.
IsKind
(SyntaxKind.InterpolatedVerbatimStringStartToken))
167
else if (token.Parent is NullableTypeSyntax && token.
IsKind
(SyntaxKind.QuestionToken))
217
if (token.
IsKind
(SyntaxKind.ExclamationToken) &&
231
if (token.
IsKind
(SyntaxKind.ColonColonToken))
237
if (token.
IsKind
(SyntaxKind.ColonToken) && token.Parent is NameColonSyntax)
243
if (token.
IsKind
(SyntaxKind.EqualsToken))
316
if (token.
IsKind
(SyntaxKind.QuestionToken) && token.Parent is ConditionalExpressionSyntax)
322
if (token.
IsKind
(SyntaxKind.EqualsGreaterThanToken))
348
if (token.
IsKind
(SyntaxKind.DefaultKeyword) && token.Parent is LineDirectiveTriviaSyntax)
360
if (token.
IsKind
(SyntaxKind.EndOfDirectiveToken))
436
text = token.GetNextToken().
IsKind
(SyntaxKind.StaticKeyword)
454
return CSharpSyntaxFacts.Instance.GetModifiers(token.Parent).Any(t => t.
IsKind
(kind));
460
if (token.
IsKind
(SyntaxKind.InKeyword))
475
if (token.
IsKind
(SyntaxKind.DefaultKeyword))
490
if (token.
IsKind
(SyntaxKind.ClassKeyword) && token.Parent is ClassOrStructConstraintSyntax)
496
if (token.
IsKind
(SyntaxKind.StructKeyword) && token.Parent is ClassOrStructConstraintSyntax)
502
if (token.
IsKind
(SyntaxKind.UsingKeyword) && token.Parent is UsingStatementSyntax or LocalDeclarationStatementSyntax)
508
if (token.
IsKind
(SyntaxKind.SwitchKeyword) && token.Parent is SwitchExpressionSyntax)
520
if (token.ValueText == "var" && token.
IsKind
(SyntaxKind.IdentifierToken) &&
System.Text.Json.SourceGeneration (1)
JsonSourceGenerator.Parser.cs (1)
182
isPartialType |= modifier.
IsKind
(SyntaxKind.PartialKeyword);
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
130
if (!typeDeclaration.Modifiers.Any(m => m.
IsKind
(SyntaxKind.PartialKeyword)))