917 references to IsKind
Microsoft.CodeAnalysis.CSharp (106)
Binder\Binder_Constraints.cs (1)
151if (questionToken.IsKind(SyntaxKind.QuestionToken))
Binder\Binder_Crefs.cs (2)
226bool isChecked = syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword); 267bool isChecked = syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword);
Binder\Binder_Expressions.cs (3)
2344Debug.Assert(node.OperatorToken.IsKind(SyntaxKind.CaretToken)); 2870if (argumentSyntax.RefKindKeyword.IsKind(SyntaxKind.InKeyword)) 2875if (argumentSyntax.RefKindKeyword.IsKind(SyntaxKind.OutKeyword))
Binder\Binder_Lambda.cs (2)
106if (modifier.IsKind(SyntaxKind.AsyncKeyword)) 111else if (modifier.IsKind(SyntaxKind.StaticKeyword))
Binder\Binder_Statements.cs (2)
597if (modifier.IsKind(SyntaxKind.StaticKeyword)) 599else if (modifier.IsKind(SyntaxKind.ExternKeyword))
Compiler\DocumentationCommentCompiler.DocumentationCommentWalker.cs (1)
103if (endGreaterThanToken.GetNextToken() is SyntaxToken newLineToken && newLineToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken))
CSharpExtensions.cs (1)
244return token.IsKind(SyntaxKind.IdentifierToken) && token.Text.Length > 0 && token.Text[0] == '@';
Declarations\DeclarationTreeBuilder.cs (5)
358if (directive.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword)) 517if (directive.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword)) 661if (modifier.IsKind(SyntaxKind.StaticKeyword) && kind == DeclarationKind.Class) 665else if (modifier.IsKind(SyntaxKind.ReadOnlyKeyword) && kind is DeclarationKind.Struct or DeclarationKind.RecordStruct) 669else if (modifier.IsKind(SyntaxKind.RefKeyword) && kind is DeclarationKind.Struct or DeclarationKind.RecordStruct)
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
54return SyntaxFacts.IsInNamespaceOrTypeContext(startNode as ExpressionSyntax) || token.IsKind(SyntaxKind.NewKeyword) || this.inNamespaceOrType; 275if (token.IsKind(SyntaxKind.IdentifierToken))
Symbols\Source\LambdaSymbol.cs (1)
360var isParams = paramSyntax?.Modifiers.Any(static m => m.IsKind(SyntaxKind.ParamsKeyword)) ?? false;
Symbols\Source\QuickAttributeChecker.cs (1)
98(!onlyGlobalAliases || usingDirective.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword)))
Symbols\Source\SourceMemberContainerSymbol.cs (1)
2690foreach (var m in modifiers) { if (m.IsKind(modifier)) return true; };
Symbols\Source\SourceMemberFieldSymbol.cs (1)
198if (modifier.IsKind(SyntaxKind.FixedKeyword))
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (1)
642if (applyIsGlobalFilter.HasValue && usingDirective.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword) != applyIsGlobalFilter.GetValueOrDefault())
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
60syntax.Keyword.IsKind(SyntaxKind.InitKeyword),
Symbols\Source\SourcePropertySymbol.cs (1)
202if (accessor.Keyword.IsKind(SyntaxKind.InitKeyword))
Symbols\Source\SourceUserDefinedConversionSymbol.cs (1)
32else if (syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword))
Symbols\Source\SourceUserDefinedOperatorSymbol.cs (1)
32else if (!syntax.OperatorToken.IsMissing && syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword))
Syntax\AnonymousFunctionExpressionSyntax.cs (1)
40return new SyntaxTokenList(Modifiers.Where(m => !m.IsKind(SyntaxKind.AsyncKeyword)));
Syntax\SyntaxFactory.cs (3)
1205if (rewrittenToken.IsKind(SyntaxKind.LessThanToken) && string.Equals("<", rewrittenToken.Text, StringComparison.Ordinal)) 1208if (rewrittenToken.IsKind(SyntaxKind.GreaterThanToken) && string.Equals(">", rewrittenToken.Text, StringComparison.Ordinal)) 2369!token.IsKind(SyntaxKind.SemicolonToken))
Syntax\SyntaxFacts.cs (3)
537case LocalDeclarationStatementSyntax local when local.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword): 538case CommonForEachStatementSyntax @foreach when @foreach.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword): 539case UsingStatementSyntax @using when @using.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword):
Syntax\SyntaxNormalizer.cs (71)
174return !token.IsKind(SyntaxKind.EndOfFileToken); 184if (currentToken.IsKind(SyntaxKind.EndOfDirectiveToken)) 200if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 235if (nextToken.IsKind(SyntaxKind.OpenBraceToken) && 279if ((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))) 318Debug.Assert(openBraceToken.IsKind(SyntaxKind.OpenBraceToken)); 335Debug.Assert(closeBraceToken.IsKind(SyntaxKind.CloseBraceToken)); 411=> currentToken.IsKind(SyntaxKind.CloseBraceToken) && 483var tokenIsOpenBrace = token.IsKind(SyntaxKind.OpenBraceToken); 484var nextIsOpenBrace = next.IsKind(SyntaxKind.OpenBraceToken); 485var tokenIsCloseBrace = token.IsKind(SyntaxKind.CloseBraceToken); 486var nextIsCloseBrace = next.IsKind(SyntaxKind.CloseBraceToken); 543var tokenIsOpenParen = token.IsKind(SyntaxKind.OpenParenToken); 544var nextIsOpenParen = next.IsKind(SyntaxKind.OpenParenToken); 545var tokenIsCloseParen = token.IsKind(SyntaxKind.CloseParenToken); 546var nextIsCloseParen = next.IsKind(SyntaxKind.CloseParenToken); 600if (next.IsKind(SyntaxKind.OpenBracketToken)) 606if (token.IsKind(SyntaxKind.OpenBracketToken)) 626return !next.IsKind(SyntaxKind.SemicolonToken); 649if (token.IsKind(SyntaxKind.GreaterThanToken) && token.Parent.IsKind(SyntaxKind.TypeArgumentList)) 657if (token.IsKind(SyntaxKind.GreaterThanToken) && 664if (token.IsKind(SyntaxKind.CommaToken) && 665!next.IsKind(SyntaxKind.CommaToken) && 677if (next.IsKind(SyntaxKind.SwitchKeyword) && next.Parent is SwitchExpressionSyntax) 682if (token.IsKind(SyntaxKind.QuestionToken)) 693if (token.IsKind(SyntaxKind.ColonToken)) 699if (next.IsKind(SyntaxKind.ColonToken)) 709if (token.IsKind(SyntaxKind.CloseBracketToken) && IsWord(next.Kind())) 715if (token.IsKind(SyntaxKind.CloseParenToken) && IsWord(next.Kind()) && token.Parent.IsKind(SyntaxKind.TupleType) == true) 720if ((next.IsKind(SyntaxKind.QuestionToken) || next.IsKind(SyntaxKind.ColonToken)) 726if (token.IsKind(SyntaxKind.EqualsToken)) 731if (next.IsKind(SyntaxKind.EqualsToken)) 741if (next.IsKind(SyntaxKind.AsteriskToken) && token.IsKind(SyntaxKind.DelegateKeyword)) 747if (token.IsKind(SyntaxKind.AsteriskToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerCallingConvention)) 759if (next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList) && next.IsKind(SyntaxKind.LessThanToken)) 779next.IsKind(SyntaxKind.OpenBracketToken)) 787if (next.IsKind(SyntaxKind.IdentifierToken)) 789if (token.IsKind(SyntaxKind.OpenBracketToken)) 795else if (token.IsKind(SyntaxKind.CommaToken)) 803if (next.IsKind(SyntaxKind.CommaToken)) 810if (next.IsKind(SyntaxKind.CloseBracketToken)) 818if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 825if (next.IsKind(SyntaxKind.GreaterThanToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 830if (token.IsKind(SyntaxKind.EqualsGreaterThanToken) || next.IsKind(SyntaxKind.EqualsGreaterThanToken)) 842if (next.IsKind(SyntaxKind.AsteriskToken) && next.Parent is PointerTypeSyntax) 848if (token.IsKind(SyntaxKind.AsteriskToken) && token.Parent is PointerTypeSyntax && 849(next.IsKind(SyntaxKind.IdentifierToken) || next.Parent.IsKind(SyntaxKind.IndexerDeclaration))) 864next.IsKind(SyntaxKind.OpenBraceToken)) 870token.IsKind(SyntaxKind.OpenBraceToken)) 876next.IsKind(SyntaxKind.CloseBraceToken)) 891if (!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 (95)
ConsecutiveBracePlacementDiagnosticAnalyzer.cs (2)
94if (!token.IsKind(SyntaxKind.CloseBraceToken)) 98if (!nextToken.IsKind(SyntaxKind.CloseBraceToken))
CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
343&& predefinedType.Keyword.IsKind(SyntaxKind.ObjectKeyword)
CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (9)
57if (directive.DirectiveNameToken.IsKind(SyntaxKind.NullableKeyword)) 81if (!directive.TargetToken.IsKind(SyntaxKind.None)) 89if (directive.TargetToken.IsKind(SyntaxKind.AnnotationsKeyword)) 93else if (directive.TargetToken.IsKind(SyntaxKind.WarningsKeyword)) 102if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 106else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 116if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 120else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 124else if (directive.SettingToken.IsKind(SyntaxKind.RestoreKeyword))
CSharpSemanticFacts.cs (2)
333return token.IsKind(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols(); 345if (token.IsKind(SyntaxKind.CommaToken))
CSharpSmartTokenFormatter.cs (4)
73return endToken.IsKind(SyntaxKind.CloseBraceToken) && 95if (token.IsKind(SyntaxKind.OpenBraceToken) && 100if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 109if (token.IsKind(SyntaxKind.OpenBraceToken) &&
CSharpSyntaxFacts.cs (1)
1521interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken);
CSharpTriviaFormatter.cs (2)
98var lines = (trivia1.IsKind(SyntaxKind.None) && this.Token1.IsKind(SyntaxKind.None)) ? 0 : 1; 200var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.Kind() == 0);
CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
234if (element.Identifier.IsKind(SyntaxKind.None))
ElasticTriviaFormattingRule.cs (5)
103currentToken.IsKind(SyntaxKind.WhereKeyword) && 118firstTokenAfterTypeConstraint.IsKind(SyntaxKind.WhereKeyword) && 130currentToken.IsKind(SyntaxKind.OpenBraceToken) && 281if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && previousToken.Parent is AttributeListSyntax 327if (!currentToken.IsKind(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax))
FormattingHelpers.cs (8)
56if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.None) || 58bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.None)) 63if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBraceToken)) 65return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBraceToken); 68if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBracketToken)) 70return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBracketToken); 277return token.IsKind(SyntaxKind.EqualsToken) && 536return currentToken.IsKind(SyntaxKind.CommaToken) &&
FormattingRangeHelper.cs (1)
348return previousToken.IsKind(SyntaxKind.OpenBraceToken) &&
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (2)
137(targetToken.IsKind(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) || 570if (token.IsKind(SyntaxKind.HashToken))
NewLineUserSettingFormattingRule.cs (32)
83if (previousToken.IsKind(SyntaxKind.CloseBraceToken) 84&& currentToken.IsKind(SyntaxKind.ElseKeyword) 94if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 103if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 112if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 130if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 148if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is MemberDeclarationSyntax) 160if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 169if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 178if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 187if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 197if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 206if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 226if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 240if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 254if (previousToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.IsKind(SyntaxKind.ElseKeyword)) 268if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 281if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 294if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 307if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 323if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 340if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 349if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is MemberDeclarationSyntax) 366if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 379if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 392if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 405if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 419if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 432if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 447if (previousToken.IsKind(SyntaxKind.SemicolonToken)
SpacingFormattingRule.cs (2)
254if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 261if (currentToken.IsKind(SyntaxKind.EndOfFileToken))
SuppressFormattingRule.cs (3)
334Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None)); 347if (!pragmaWarningDirectiveTrivia.DisableOrRestoreKeyword.IsKind(disableOrRestoreKeyword))
SyntaxTokenExtensions.cs (3)
46return (token.IsKind(SyntaxKind.OpenBraceToken) || token.IsKind(SyntaxKind.CommaToken)) && 51=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList);
SyntaxTriviaExtensions.cs (1)
206isDisable = pragmaWarning.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword);
TokenBasedFormattingRule.cs (7)
89if (!currentToken.IsKind(SyntaxKind.SemicolonToken) && 285if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 289if (currentToken.IsKind(SyntaxKind.OpenBracketToken)) 372if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 391if (currentToken.IsKind(SyntaxKind.ColonToken)) 451if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 464if (currentToken.IsKind(SyntaxKind.QuestionToken) &&
TriviaDataFactory.Analyzer.cs (1)
66for (var currentToken = token1; !currentToken.IsKind(SyntaxKind.None);)
TypeSyntaxExtensions.cs (2)
15predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword); 20((IdentifierNameSyntax)typeSyntax).Identifier.IsKind(SyntaxKind.PartialKeyword);
UsingsAndExternAliasesOrganizer.cs (2)
61var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 62var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword);
WrappingFormattingRule.cs (4)
94if (!firstToken.IsKind(SyntaxKind.None) || !lastToken.IsKind(SyntaxKind.None)) 124if (!tokens.firstToken.IsKind(SyntaxKind.None) || !tokens.lastToken.IsKind(SyntaxKind.None))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (202)
ConsecutiveBracePlacementCodeFixProvider.cs (2)
73if (!token.IsKind(SyntaxKind.CloseBraceToken)) 80if (!firstBrace.IsKind(SyntaxKind.CloseBraceToken))
ConvertToRecordEngine.cs (3)
34if (typeDeclaration.Modifiers.Any(modifier => modifier.IsKind(SyntaxKind.PartialKeyword))) 716if (prevToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken)) 773token.IsKind(SyntaxKind.XmlTextLiteralToken)
CSharpCodeGenerationService.cs (1)
463ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, (SyntaxToken t) => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia);
CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
91if (!methodDeclaration.Modifiers.Any(m => m.IsKind(SyntaxKind.AsyncKeyword)))
CSharpIndentationService.cs (4)
80if (token.IsKind(SyntaxKind.None) || 110return token.IsKind(SyntaxKind.None) || 111token.IsKind(SyntaxKind.EndOfDirectiveToken) || 112token.IsKind(SyntaxKind.EndOfFileToken);
CSharpIndentationService.Indenter.cs (6)
84if (token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 128if (interpolatedExpression.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 142if (!indenter.Root.FindToken(currentLine.Start, findInsideTrivia: true).IsKind(SyntaxKind.InterpolatedStringTextToken)) 178token.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken) || 179token.IsKind(SyntaxKind.InterpolatedStringTextToken) || 180(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation)))
CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
49token.IsKind(SyntaxKind.DefaultKeyword) &&
CSharpSyntaxContext.cs (6)
227var isDestructorTypeContext = targetToken.IsKind(SyntaxKind.TildeToken) && 259isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken), 348if (!previousToken.IsKind(SyntaxKind.RecordKeyword)) 432if (targetToken.IsKind(SyntaxKind.AwaitKeyword)) 443&& targetToken.IsKind(SyntaxKind.IdentifierToken) 482if (targetToken.IsKind(SyntaxKind.InKeyword))
CSharpTypeInferenceService.TypeInferrer.cs (2)
346if (previousToken.IsKind(SyntaxKind.CommaToken)) 2025if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword)))
CSharpUseLocalFunctionCodeFixProvider.cs (1)
218if (anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword))
ITypeSymbolExtensions.cs (1)
100if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (2)
25if (token.IsKind(SyntaxKind.UsingKeyword)) 40if (token.IsKind(SyntaxKind.StaticKeyword))
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (170)
35if (token.IsKind(SyntaxKind.OpenBracketToken) && 43if (token.IsKind(SyntaxKind.CommaToken) && 51if (token.IsKind(SyntaxKind.ColonToken) && 94if (token.IsKind(SyntaxKind.CloseBracketToken) 165if (token.IsKind(SyntaxKind.OpenBraceToken)) 176if (token.IsKind(SyntaxKind.SemicolonToken)) 193if (token.IsKind(SyntaxKind.CloseBraceToken)) 219if (token.IsKind(SyntaxKind.CloseBracketToken) && 425if (token.IsKind(SyntaxKind.None)) 439if (token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax) 454if (token.IsKind(SyntaxKind.SemicolonToken)) 476if (token.IsKind(SyntaxKind.CloseBraceToken)) 506if (token.IsKind(SyntaxKind.CloseBracketToken) && 630if (token.IsKind(SyntaxKind.ColonColonToken) && 631token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword)) 643if (token.IsKind(SyntaxKind.UsingKeyword)) 691if ((token.IsKind(SyntaxKind.ClassKeyword) || 692token.IsKind(SyntaxKind.StructKeyword) || 693token.IsKind(SyntaxKind.InterfaceKeyword)) && 694token.GetPreviousToken().IsKind(SyntaxKind.PartialKeyword)) 775if (token.IsKind(SyntaxKind.ColonToken) || 776token.IsKind(SyntaxKind.CommaToken)) 794if (token.IsKind(SyntaxKind.EqualsToken) && 823if (token.IsKind(SyntaxKind.WhereKeyword) && 829if (token.IsKind(SyntaxKind.IdentifierToken) && 850if (token.IsKind(SyntaxKind.ColonToken) && 851token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) && 852token.GetPreviousToken(includeSkipped: true).GetPreviousToken().IsKind(SyntaxKind.WhereKeyword)) 876if (token.IsKind(SyntaxKind.CommaToken) && 895if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 907if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 920if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 1048if (token.IsKind(SyntaxKind.OpenParenToken) && 1055if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1061if (token.IsKind(SyntaxKind.CommaToken) && 1071if (token.IsKind(SyntaxKind.CommaToken) && 1080if (token.IsKind(SyntaxKind.CloseBracketToken) && 1096else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName) 1132if (token.IsKind(SyntaxKind.OpenBracketToken) || token.IsKind(SyntaxKind.CommaToken)) 1146if (token.IsKind(SyntaxKind.DelegateKeyword) && 1161if (token.IsKind(SyntaxKind.OperatorKeyword)) 1163if (token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.ImplicitKeyword) || 1164token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.ExplicitKeyword)) 1184if (token.IsKind(SyntaxKind.OpenParenToken) || 1185token.IsKind(SyntaxKind.OpenBracketToken) || 1186token.IsKind(SyntaxKind.CommaToken)) 1251else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1255else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1306if (leftToken.IsKind(SyntaxKind.CloseParenToken)) 1323if (leftToken.IsKind(SyntaxKind.IdentifierToken)) 1334if (leftToken.IsKind(SyntaxKind.IdentifierToken) && 1352if (leftToken.IsKind(SyntaxKind.OpenParenToken)) 1398if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1406if (leftToken.IsKind(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 1424if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1449if (leftToken.IsKind(SyntaxKind.DotToken)) 1510binaryExpressionSyntax.OperatorToken.IsKind(SyntaxKind.IsKeyword) && 1613if (leftToken.IsKind(SyntaxKind.OpenParenToken) && leftToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1769if (token.IsKind(SyntaxKind.ConstKeyword) && 1801if (token.IsKind(SyntaxKind.OutKeyword) && 1813if (token.IsKind(SyntaxKind.OpenParenToken)) 1816if (previous.IsKind(SyntaxKind.ForKeyword) || 1817previous.IsKind(SyntaxKind.ForEachKeyword) || 1818previous.IsKind(SyntaxKind.UsingKeyword)) 1826if (token.IsKind(SyntaxKind.UsingKeyword) && 1841if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.JoinKeyword) && 1853if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 1859if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax) 1876if (token.IsKind(SyntaxKind.OpenParenToken) && 1877token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword)) 1893if (token.IsKind(SyntaxKind.OpenParenToken) && 1894token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CatchKeyword)) 1907if (token.IsKind(SyntaxKind.IsKeyword) || 1908token.IsKind(SyntaxKind.AsKeyword)) 1921if (token.IsKind(SyntaxKind.NewKeyword)) 1975if (token.IsKind(SyntaxKind.None)) 2025if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.OpenParenToken) && 2039if (token.IsKind(SyntaxKind.OpenParenToken) && 2059if (token.IsKind(SyntaxKind.CaseKeyword) && 2065if (token.IsKind(SyntaxKind.EqualsToken) && 2102(token.IsKind(SyntaxKind.CommaToken) || 2103token.IsKind(SyntaxKind.OpenParenToken))) 2109if (token.IsKind(SyntaxKind.ColonToken) && 2117if (token.IsKind(SyntaxKind.EqualsToken) && 2188if (token.IsKind(SyntaxKind.DotToken) || 2189token.IsKind(SyntaxKind.ColonColonToken) || 2190token.IsKind(SyntaxKind.MinusGreaterThanToken)) 2197if (token.IsKind(SyntaxKind.EqualsToken)) 2219if (token.IsKind(SyntaxKind.EqualsToken) || 2220token.IsKind(SyntaxKind.MinusEqualsToken) || 2221token.IsKind(SyntaxKind.AsteriskEqualsToken) || 2222token.IsKind(SyntaxKind.PlusEqualsToken) || 2223token.IsKind(SyntaxKind.SlashEqualsToken) || 2224token.IsKind(SyntaxKind.ExclamationEqualsToken) || 2225token.IsKind(SyntaxKind.CaretEqualsToken) || 2226token.IsKind(SyntaxKind.AmpersandEqualsToken) || 2227token.IsKind(SyntaxKind.BarEqualsToken) || 2228token.IsKind(SyntaxKind.PercentEqualsToken) || 2229token.IsKind(SyntaxKind.LessThanLessThanEqualsToken) || 2230token.IsKind(SyntaxKind.GreaterThanGreaterThanEqualsToken) || 2231token.IsKind(SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken) || 2232token.IsKind(SyntaxKind.QuestionQuestionEqualsToken)) 2238if (token.IsKind(SyntaxKind.OpenParenToken)) 2313if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2330tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2333if (previousToken.IsKind(SyntaxKind.AsteriskToken) || 2334previousToken.IsKind(SyntaxKind.QuestionToken)) 2360if (token.IsKind(SyntaxKind.OpenBracketToken) || 2361token.IsKind(SyntaxKind.CommaToken)) 2371if (token.IsKind(SyntaxKind.DotDotToken) && 2379if (token.IsKind(SyntaxKind.QuestionToken) && 2388if (token.IsKind(SyntaxKind.ColonToken) && 2397if (token.IsKind(SyntaxKind.OpenParenToken)) 2419if (token.IsKind(SyntaxKind.OpenParenToken) || 2420token.IsKind(SyntaxKind.OpenBracketToken) || 2421token.IsKind(SyntaxKind.CommaToken)) 2433if (token.IsKind(SyntaxKind.OpenParenToken) || 2434token.IsKind(SyntaxKind.CommaToken)) 2447if (token.IsKind(SyntaxKind.RefKeyword) || 2448token.IsKind(SyntaxKind.InKeyword) || 2449token.IsKind(SyntaxKind.OutKeyword)) 2469if (token.IsKind(SyntaxKind.ColonToken) && 2477if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2484if (token.IsKind(SyntaxKind.OpenBraceToken) || 2485token.IsKind(SyntaxKind.CommaToken)) 2491if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2494if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2521if (token.IsKind(SyntaxKind.SemicolonToken) && 2532if (token.IsKind(SyntaxKind.OpenParenToken) && 2541if (token.IsKind(SyntaxKind.CommaToken) && 2551if (token.IsKind(SyntaxKind.InKeyword)) 2565if (token.IsKind(SyntaxKind.OnKeyword) || 2566token.IsKind(SyntaxKind.EqualsKeyword)) 2575if (token.IsKind(SyntaxKind.WhereKeyword) && 2583if (token.IsKind(SyntaxKind.OrderByKeyword) || 2584token.IsKind(SyntaxKind.CommaToken)) 2593if (token.IsKind(SyntaxKind.SelectKeyword) && 2601if (token.IsKind(SyntaxKind.GroupKeyword) || 2602token.IsKind(SyntaxKind.ByKeyword)) 2613if (token.IsKind(SyntaxKind.ReturnKeyword)) 2622if (token.IsKind(SyntaxKind.ThrowKeyword)) 2628if (token.IsKind(SyntaxKind.OpenParenToken) && 2629token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2644if (token.IsKind(SyntaxKind.OpenParenToken) && 2645token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2651if (token.IsKind(SyntaxKind.OpenParenToken) && 2652token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2658if (token.IsKind(SyntaxKind.OpenParenToken) && 2659token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2665if (token.IsKind(SyntaxKind.OpenParenToken) && 2666token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2672if (token.IsKind(SyntaxKind.OpenParenToken) && 2673token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2679if (token.IsKind(SyntaxKind.OpenParenToken) && 2680token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2686if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2703if (token.IsKind(SyntaxKind.OpenBraceToken) || token.IsKind(SyntaxKind.CommaToken)) 2726if (token.IsKind(SyntaxKind.OpenBraceToken)) 2747if (token.IsKind(SyntaxKind.DotToken)) 2819if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2862if (token.IsKind(SyntaxKind.IdentifierToken) && 2946if (token.IsKind(SyntaxKind.CloseBraceToken)) 2974if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2979if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2998token.IsKind(SyntaxKind.ColonToken) && 3009if (!token.IsKind(SyntaxKind.DotToken)) 3060return targetToken.IsKind(SyntaxKind.AsteriskToken) &&
TypeDeclarationSyntaxExtensions.cs (2)
100if (token.IsMissing || token.IsKind(SyntaxKind.None)) 115if (typeDeclaration.SemicolonToken.IsKind(SyntaxKind.SemicolonToken))
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (2)
CommandLineTests.cs (2)
14639if ((context.Node as PragmaWarningDirectiveTriviaSyntax).DisableOrRestoreKeyword.IsKind(SyntaxKind.RestoreKeyword)) 14694if ((nodeContext.Node as PragmaWarningDirectiveTriviaSyntax).DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword))
Microsoft.CodeAnalysis.CSharp.EditorFeatures (10)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (2)
634if (syntaxToken.IsMissing || syntaxToken.IsKind(SyntaxKind.None)) 673if (token.IsKind(SyntaxKind.None))
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (3)
381if (nextToken.IsKind(SyntaxKind.SemicolonToken) 761return openBrace.IsKind(SyntaxKind.None) && closeBrace.IsKind(SyntaxKind.None)
CompleteStatement\CompleteStatementCommandHandler.cs (2)
163if (!openingDelimiter.IsKind(SyntaxKind.None) && openingDelimiter.Span.Start >= caretPosition 164|| !closingDelimiter.IsKind(SyntaxKind.None) && closingDelimiter.Span.End <= caretPosition)
DocumentationComments\XmlTagCompletionCommandHandler.cs (2)
41if (token.IsKind(SyntaxKind.GreaterThanToken)) 65else if (token.IsKind(SyntaxKind.LessThanSlashToken))
FixInterpolatedVerbatimString\FixInterpolatedVerbatimStringCommandHandler.cs (1)
80if (token.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken))
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (1)
3422if (position == endToken.SpanStart && !endToken.GetPreviousToken().IsKind(SyntaxKind.None))
Microsoft.CodeAnalysis.CSharp.Features (145)
BraceCompletion\BracketBraceCompletionService.cs (3)
39protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.OpenBracketToken); 41protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CloseBracketToken); 57if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && currentToken.Parent.IsKind(SyntaxKind.ListPattern))
BraceCompletion\CharLiteralBraceCompletionService.cs (2)
34protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CharacterLiteralToken); 36protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CharacterLiteralToken);
BraceCompletion\CurlyBraceCompletionService.cs (3)
56=> token.IsKind(SyntaxKind.OpenBraceToken) && !token.Parent.IsKind(SyntaxKind.Interpolation); 59=> token.IsKind(SyntaxKind.CloseBraceToken); 132if (!currentToken.IsKind(SyntaxKind.OpenBraceToken))
BraceCompletion\InterpolatedStringBraceCompletionService.cs (3)
45=> leftToken.IsKind(SyntaxKind.InterpolatedStringStartToken) || leftToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken); 48=> rightToken.IsKind(SyntaxKind.InterpolatedStringEndToken);
BraceCompletion\InterpolationBraceCompletionService.cs (2)
47=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation); 50=> token.IsKind(SyntaxKind.CloseBraceToken);
BraceCompletion\LessAndGreaterThanBraceCompletionService.cs (2)
37=> token.IsKind(SyntaxKind.LessThanToken); 40=> token.IsKind(SyntaxKind.GreaterThanToken);
BraceCompletion\ParenthesisBraceCompletionService.cs (2)
33protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.OpenParenToken); 35protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CloseParenToken);
BraceCompletion\StringLiteralBraceCompletionService.cs (4)
45protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.StringLiteralToken); 47protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.StringLiteralToken); 67if (token.IsKind(SyntaxKind.StringLiteralToken) && 88while (!token.IsKind(SyntaxKind.None) && !token.TrailingTrivia.Contains(t => t.IsEndOfLine()))
BraceMatching\StringLiteralBraceMatcher.cs (3)
35if (token.IsKind(SyntaxKind.StringLiteralToken)) 39else if (token.IsKind(SyntaxKind.Utf8StringLiteralToken)) 50else if (token.IsKind(SyntaxKind.InterpolatedStringEndToken))
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (13)
47if (token.IsKind(SyntaxKind.EndOfDirectiveToken)) 92if (firstToken.IsKind(SyntaxKind.None)) 113if (firstNonDirectiveToken.IsKind(SyntaxKind.None) && firstDirective is null) 130if (originalNode.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 136if (originalNode.SettingToken.IsKind(SyntaxKind.RestoreKeyword)) 141if (originalNode.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 168else if (leadingDirective.SettingToken.IsKind(SyntaxKind.RestoreKeyword) && leadingDirective.TargetToken.IsKind(SyntaxKind.None)) 212if (firstToken.IsKind(SyntaxKind.None)) 217if (firstToken.IsKind(SyntaxKind.HashToken) && firstToken.Parent.IsKind(SyntaxKind.RegionDirectiveTrivia)) 222if (nextToken.IsKind(SyntaxKind.HashToken) && nextToken.Parent.IsKind(SyntaxKind.EndRegionDirectiveTrivia)) 237&& nullableDirective.TargetToken.IsKind(SyntaxKind.None)) 240if (firstSemanticToken.IsKind(SyntaxKind.None) || firstSemanticToken.SpanStart > nullableDirective.Span.End)
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (2)
161var displayTextSuffix = rightToken.IsKind(SyntaxKind.EqualsToken) ? null : SpaceEqualsString; 183var displayTextSuffix = rightToken.IsKind(SyntaxKind.ColonToken) ? null : ColonString;
Completion\CompletionProviders\CrefCompletionProvider.cs (4)
144if (token.IsKind(SyntaxKind.OpenParenToken) && 150if (token.IsKind(SyntaxKind.OpenBracketToken) && 164return token.IsKind(SyntaxKind.DotToken) 293if (symbol is INamespaceOrTypeSymbol && token.IsKind(SyntaxKind.DotToken))
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (2)
116if (token.IsKind(SyntaxKind.NewKeyword) && token.Parent.IsKind(SyntaxKind.ObjectCreationExpression)) 168if (previousToken.IsKind(SyntaxKind.DotToken) &&
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (6)
148if (token.IsKind(SyntaxKind.IdentifierToken) && 238if (!IsPossibleTypeToken(token) && !token.IsKind(SyntaxKind.CommaToken)) 249if (token.IsKind(SyntaxKind.CommaToken) && token.Parent != target) 260if (!token.IsKind(SyntaxKind.CommaToken) && token != typeSyntax.GetLastToken()) 358var possibleDeclarationComputer = token.IsKind(SyntaxKind.CommaToken) 378if (token.IsKind(SyntaxKind.QuestionToken) &&
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
87if (token.IsKind(SyntaxKind.DotToken))
Completion\CompletionProviders\ExternAliasCompletionProvider.cs (2)
59if (!targetToken.IsKind(SyntaxKind.AliasKeyword) 60&& !(targetToken.IsKind(SyntaxKind.IdentifierToken) && targetToken.HasMatchingText(SyntaxKind.AliasKeyword)))
Completion\CompletionProviders\ImportCompletion\ExtensionMethodImportCompletionProvider.cs (1)
46if (token.IsKind(SyntaxKind.None) || token.IsMissing)
Completion\CompletionProviders\ImportCompletion\TypeImportCompletionProvider.cs (1)
48if (token.IsKind(SyntaxKind.None) || token.IsMissing)
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (2)
136return !syntaxToken.IsKind(SyntaxKind.None) 137&& !touchingToken.IsKind(SyntaxKind.None)
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (1)
76=> syntax is BaseTypeDeclarationSyntax declarationSyntax && declarationSyntax.Modifiers.Any(modifier => modifier.IsKind(SyntaxKind.PartialKeyword));
Completion\CompletionProviders\PropertySubPatternCompletionProvider.cs (1)
188if (token.IsKind(SyntaxKind.DotToken))
Completion\CompletionProviders\SpeculativeTCompletionProvider.cs (1)
133if (tokenLeftOfGenericName.IsKind(SyntaxKind.DotToken) && tokenLeftOfGenericName.Parent.IsKind(SyntaxKind.QualifiedName))
Completion\CompletionProviders\TupleNameCompletionProvider.cs (2)
75if (token.IsKind(SyntaxKind.OpenParenToken)) 83if (token.IsKind(SyntaxKind.CommaToken) && token.Parent is TupleExpressionSyntax tupleExpr)
Completion\CompletionProviders\XmlDocCommentCompletionProvider.cs (5)
114(token.Parent.IsKind(SyntaxKind.XmlElementEndTag) && token.IsKind(SyntaxKind.GreaterThanToken)) || 125var xmlNameOnly = token.IsKind(SyntaxKind.LessThanToken) 186if (token.IsKind(SyntaxKind.XmlTextLiteralToken) && string.IsNullOrWhiteSpace(token.Text)) 202if (token.IsKind(SyntaxKind.IdentifierToken) && token.Parent.IsKind(SyntaxKind.XmlName)) 270else if (token.IsKind(SyntaxKind.XmlTextLiteralToken) &&
Completion\KeywordRecommenders\ReadOnlyKeywordRecommender.cs (1)
45=> context.TargetToken.IsKind(SyntaxKind.RefKeyword) &&
Completion\KeywordRecommenders\RefKeywordRecommender.cs (2)
171return previous.IsKind(SyntaxKind.ForKeyword) 172|| previous.IsKind(SyntaxKind.ForEachKeyword);
Completion\KeywordRecommenders\ThrowKeywordRecommender.cs (2)
25if (context.TargetToken.IsKind(SyntaxKind.EqualsGreaterThanToken)) 31if (context.TargetToken.IsKind(SyntaxKind.QuestionQuestionToken))
Completion\KeywordRecommenders\WhereKeywordRecommender.cs (1)
101if (token.IsKind(SyntaxKind.DotToken))
ConsecutiveBracePlacementCodeFixProvider.cs (2)
73if (!token.IsKind(SyntaxKind.CloseBraceToken)) 80if (!firstBrace.IsKind(SyntaxKind.CloseBraceToken))
ConsecutiveBracePlacementDiagnosticAnalyzer.cs (2)
94if (!token.IsKind(SyntaxKind.CloseBraceToken)) 98if (!nextToken.IsKind(SyntaxKind.CloseBraceToken))
ConvertToRecordEngine.cs (3)
34if (typeDeclaration.Modifiers.Any(modifier => modifier.IsKind(SyntaxKind.PartialKeyword))) 716if (prevToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken)) 773token.IsKind(SyntaxKind.XmlTextLiteralToken)
CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
343&& predefinedType.Keyword.IsKind(SyntaxKind.ObjectKeyword)
CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
91if (!methodDeclaration.Modifiers.Any(m => m.IsKind(SyntaxKind.AsyncKeyword)))
CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (9)
57if (directive.DirectiveNameToken.IsKind(SyntaxKind.NullableKeyword)) 81if (!directive.TargetToken.IsKind(SyntaxKind.None)) 89if (directive.TargetToken.IsKind(SyntaxKind.AnnotationsKeyword)) 93else if (directive.TargetToken.IsKind(SyntaxKind.WarningsKeyword)) 102if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 106else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 116if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 120else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 124else if (directive.SettingToken.IsKind(SyntaxKind.RestoreKeyword))
CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
49token.IsKind(SyntaxKind.DefaultKeyword) &&
CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
234if (element.Identifier.IsKind(SyntaxKind.None))
CSharpUseLocalFunctionCodeFixProvider.cs (1)
218if (anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword))
Debugging\BreakpointResolver.cs (1)
78if (token.IsKind(SyntaxKind.SemicolonToken))
Debugging\DataTipInfoGetter.cs (1)
36return token.IsKind(SyntaxKind.IdentifierToken)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (7)
2208if (((LocalDeclarationStatementSyntax)node).UsingKeyword.IsKind(SyntaxKind.UsingKeyword)) 2225Debug.Assert(((CommonForEachStatementSyntax)node).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2229RoslynDebug.Assert(((LocalDeclarationStatementSyntax)node.Parent!.Parent!).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2726deletedForeachStatement.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)) 2740!((LocalDeclarationStatementSyntax)newLocalDeclaration).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)) 2760!oldForEachStatement.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)) 2774!((LocalDeclarationStatementSyntax)oldLocalDeclaration).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword))
EditAndContinue\SyntaxComparer.cs (4)
831if (leftUsing.GlobalKeyword.IsKind(SyntaxKind.None) != rightUsing.GlobalKeyword.IsKind(SyntaxKind.None)) 835if (leftUsing.UnsafeKeyword.IsKind(SyntaxKind.None) != rightUsing.UnsafeKeyword.IsKind(SyntaxKind.None))
EditAndContinue\SyntaxUtilities.cs (1)
267return anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword);
ExtractMethod\CSharpMethodExtractor.cs (1)
215if (!leadingTrivia.Any(t => t.IsKind(SyntaxKind.EndOfLineTrivia)) && !methodDefinition.FindTokenOnLeftOfPosition(methodDefinition.SpanStart).IsKind(SyntaxKind.OpenBraceToken))
GenerateType\CSharpGenerateTypeService.cs (5)
231!token.IsKind(SyntaxKind.DotToken)) 247if (token.IsKind(SyntaxKind.DotToken) && 267nextToken.IsKind(SyntaxKind.DotToken)) 285if (nextToken.IsKind(SyntaxKind.DotToken)) 317if (nextToken.IsKind(SyntaxKind.DotToken))
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
40if (token.GetPreviousToken().IsKind(SyntaxKind.YieldKeyword))
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (1)
69var end = !gotoStatement.CaseOrDefaultKeyword.IsKind(SyntaxKind.None)
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
298if (localFunction != null && !localFunction.Modifiers.Any(modifier => modifier.IsKind(SyntaxKind.StaticKeyword)))
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (1)
62=> token.IsKind(SyntaxKind.EndOfDirectiveToken)
QuickInfo\CSharpSemanticQuickInfoProvider.cs (3)
31if (token.IsKind(SyntaxKind.EqualsGreaterThanToken) 38else if (token.IsKind(SyntaxKind.DelegateKeyword) && token.Parent.IsKind(SyntaxKind.AnonymousMethodExpression)) 64if (token.IsKind(SyntaxKind.DotToken) &&
SignatureHelp\AttributeSignatureHelpProvider.cs (1)
59return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (3)
288return !token.IsKind(SyntaxKind.None) && 337return !token.IsKind(SyntaxKind.None) && 372return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\GenericNameSignatureHelpProvider.cs (1)
63return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (1)
48=> !token.IsKind(SyntaxKind.None) &&
SignatureHelp\SignatureHelpUtilities.cs (3)
103if (token.IsKind(SyntaxKind.OpenParenToken) && 130if (token.IsKind(SyntaxKind.CommaToken) && token.Parent is TupleExpressionSyntax && token.GetAncestor<TSyntaxNode>() != null) 135return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (1)
227=> token.IsKind(SyntaxKind.OpenParenToken) && token.Parent is ParenthesizedExpressionSyntax;
SplitStringLiteral\SimpleStringSplitter.cs (1)
40return _token.IsKind(SyntaxKind.Utf8StringLiteralToken) && CursorPosition >= _token.Span.End - "u8".Length;
SplitStringLiteral\StringSplitter.cs (4)
52if (token.IsKind(SyntaxKind.StringLiteralToken) || 53token.IsKind(SyntaxKind.Utf8StringLiteralToken)) 72if (token.IsKind(SyntaxKind.InterpolatedStringTextToken) || 73token.IsKind(SyntaxKind.InterpolatedStringEndToken) ||
StringIndentation\CSharpStringIndentationService.cs (1)
63interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken))
Structure\CSharpStructureHelpers.cs (2)
259if (startToken.IsKind(SyntaxKind.None) || endToken.IsKind(SyntaxKind.None))
Structure\Providers\BlockSyntaxStructureProvider.cs (1)
98if (previousToken.IsKind(SyntaxKind.None))
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (4)
68updatedProperty.Modifiers.Where(token => !token.IsKind(SyntaxKind.ReadOnlyKeyword))); 96if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList)) 101if (previousToken.IsKind(SyntaxKind.OpenBraceToken) && previousToken.Parent.IsKind(SyntaxKind.AccessorList)) 106if (currentToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList))
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\UnsafeTests.cs (2)
5507foreach (var nullSyntax in tree.GetCompilationUnitRoot().DescendantTokens().Where(token => token.IsKind(SyntaxKind.NullKeyword))) 5543foreach (var declarationSyntax in tree.GetCompilationUnitRoot().DescendantTokens().OfType<VariableDeclarationSyntax>().Where(syntax => syntax.GetFirstToken().IsKind(SyntaxKind.VoidKeyword)))
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (4)
Syntax\SyntaxAnnotationTests.cs (3)
693if (!token.IsKind(SyntaxKind.None)) 734if (token.IsKind(SyntaxKind.None)) 834if (token.IsKind(SyntaxKind.None))
Syntax\SyntaxNodeTests.cs (1)
2230var tokens = expr.DescendantTokens().Where(t => t.IsKind(SyntaxKind.IdentifierToken)).ToList();
Microsoft.CodeAnalysis.CSharp.Workspaces (319)
Classification\ClassificationHelpers.cs (17)
34else if (SyntaxFacts.IsKeywordKind(token.Kind()) || token.IsKind(SyntaxKind.DiscardDesignation)) 143return token.IsKind(SyntaxKind.StringLiteralToken) 144|| token.IsKind(SyntaxKind.Utf8StringLiteralToken) 145|| token.IsKind(SyntaxKind.CharacterLiteralToken) 146|| token.IsKind(SyntaxKind.InterpolatedStringStartToken) 147|| token.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken) 148|| token.IsKind(SyntaxKind.InterpolatedStringTextToken) 149|| token.IsKind(SyntaxKind.InterpolatedStringEndToken) 150|| token.IsKind(SyntaxKind.InterpolatedRawStringEndToken) 151|| token.IsKind(SyntaxKind.InterpolatedSingleLineRawStringStartToken) 152|| token.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken) 153|| token.IsKind(SyntaxKind.SingleLineRawStringLiteralToken) 154|| token.IsKind(SyntaxKind.Utf8SingleLineRawStringLiteralToken) 155|| token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken) 156|| token.IsKind(SyntaxKind.Utf8MultiLineRawStringLiteralToken); 176&& interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken); 187&& interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken);
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
150identifierNameSyntax.Identifier.IsKind(SyntaxKind.GlobalKeyword);
CodeGeneration\CSharpSyntaxGenerator.cs (2)
1016=> list.Target?.Identifier.IsKind(SyntaxKind.ReturnKeyword) ?? false; 1984=> type is PredefinedTypeSyntax pd && pd.Keyword.IsKind(SyntaxKind.VoidKeyword) ? null : type;
CSharpCodeGenerationService.cs (1)
463ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, (SyntaxToken t) => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia);
CSharpIndentationService.cs (4)
80if (token.IsKind(SyntaxKind.None) || 110return token.IsKind(SyntaxKind.None) || 111token.IsKind(SyntaxKind.EndOfDirectiveToken) || 112token.IsKind(SyntaxKind.EndOfFileToken);
CSharpIndentationService.Indenter.cs (6)
84if (token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 128if (interpolatedExpression.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 142if (!indenter.Root.FindToken(currentLine.Start, findInsideTrivia: true).IsKind(SyntaxKind.InterpolatedStringTextToken)) 178token.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken) || 179token.IsKind(SyntaxKind.InterpolatedStringTextToken) || 180(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation)))
CSharpSemanticFacts.cs (2)
333return token.IsKind(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols(); 345if (token.IsKind(SyntaxKind.CommaToken))
CSharpSmartTokenFormatter.cs (4)
73return endToken.IsKind(SyntaxKind.CloseBraceToken) && 95if (token.IsKind(SyntaxKind.OpenBraceToken) && 100if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 109if (token.IsKind(SyntaxKind.OpenBraceToken) &&
CSharpSyntaxContext.cs (6)
227var isDestructorTypeContext = targetToken.IsKind(SyntaxKind.TildeToken) && 259isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken), 348if (!previousToken.IsKind(SyntaxKind.RecordKeyword)) 432if (targetToken.IsKind(SyntaxKind.AwaitKeyword)) 443&& targetToken.IsKind(SyntaxKind.IdentifierToken) 482if (targetToken.IsKind(SyntaxKind.InKeyword))
CSharpSyntaxFacts.cs (1)
1521interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken);
CSharpTriviaFormatter.cs (2)
98var lines = (trivia1.IsKind(SyntaxKind.None) && this.Token1.IsKind(SyntaxKind.None)) ? 0 : 1; 200var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.Kind() == 0);
CSharpTypeInferenceService.TypeInferrer.cs (2)
346if (previousToken.IsKind(SyntaxKind.CommaToken)) 2025if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword)))
ElasticTriviaFormattingRule.cs (5)
103currentToken.IsKind(SyntaxKind.WhereKeyword) && 118firstTokenAfterTypeConstraint.IsKind(SyntaxKind.WhereKeyword) && 130currentToken.IsKind(SyntaxKind.OpenBraceToken) && 281if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && previousToken.Parent is AttributeListSyntax 327if (!currentToken.IsKind(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax))
Formatting\CSharpSyntaxFormattingService.cs (9)
67if (token.IsKind(SyntaxKind.CloseParenToken) && !token.Parent.IsKind(SyntaxKind.UsingStatement)) 75if (token.IsKind(SyntaxKind.ColonToken) && !(token.Parent.IsKind(SyntaxKind.LabeledStatement) || token.Parent is SwitchLabelSyntax)) 82if (token.IsKind(SyntaxKind.OpenBraceToken)) 132(token.IsKind(SyntaxKind.CloseBraceToken) && OnlySmartIndentCloseBrace(indentationOptions.AutoFormattingOptions)) || 133(token.IsKind(SyntaxKind.OpenBraceToken) && OnlySmartIndentOpenBrace(indentationOptions.AutoFormattingOptions)); 290if (endToken.IsKind(SyntaxKind.OpenBraceToken)) 312return token.IsKind(SyntaxKind.None) || 313token.IsKind(SyntaxKind.EndOfDirectiveToken) || 314token.IsKind(SyntaxKind.EndOfFileToken);
FormattingHelpers.cs (8)
56if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.None) || 58bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.None)) 63if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBraceToken)) 65return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBraceToken); 68if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBracketToken)) 70return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBracketToken); 277return token.IsKind(SyntaxKind.EqualsToken) && 536return currentToken.IsKind(SyntaxKind.CommaToken) &&
FormattingRangeHelper.cs (1)
348return previousToken.IsKind(SyntaxKind.OpenBraceToken) &&
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (3)
46return (token.IsKind(SyntaxKind.OpenBraceToken) || token.IsKind(SyntaxKind.CommaToken)) && 51=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (2)
137(targetToken.IsKind(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) || 570if (token.IsKind(SyntaxKind.HashToken))
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs\TypeSyntaxExtensions.cs (2)
15predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword); 20((IdentifierNameSyntax)typeSyntax).Identifier.IsKind(SyntaxKind.PartialKeyword);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (2)
25if (token.IsKind(SyntaxKind.UsingKeyword)) 40if (token.IsKind(SyntaxKind.StaticKeyword))
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (170)
35if (token.IsKind(SyntaxKind.OpenBracketToken) && 43if (token.IsKind(SyntaxKind.CommaToken) && 51if (token.IsKind(SyntaxKind.ColonToken) && 94if (token.IsKind(SyntaxKind.CloseBracketToken) 165if (token.IsKind(SyntaxKind.OpenBraceToken)) 176if (token.IsKind(SyntaxKind.SemicolonToken)) 193if (token.IsKind(SyntaxKind.CloseBraceToken)) 219if (token.IsKind(SyntaxKind.CloseBracketToken) && 425if (token.IsKind(SyntaxKind.None)) 439if (token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax) 454if (token.IsKind(SyntaxKind.SemicolonToken)) 476if (token.IsKind(SyntaxKind.CloseBraceToken)) 506if (token.IsKind(SyntaxKind.CloseBracketToken) && 630if (token.IsKind(SyntaxKind.ColonColonToken) && 631token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword)) 643if (token.IsKind(SyntaxKind.UsingKeyword)) 691if ((token.IsKind(SyntaxKind.ClassKeyword) || 692token.IsKind(SyntaxKind.StructKeyword) || 693token.IsKind(SyntaxKind.InterfaceKeyword)) && 694token.GetPreviousToken().IsKind(SyntaxKind.PartialKeyword)) 775if (token.IsKind(SyntaxKind.ColonToken) || 776token.IsKind(SyntaxKind.CommaToken)) 794if (token.IsKind(SyntaxKind.EqualsToken) && 823if (token.IsKind(SyntaxKind.WhereKeyword) && 829if (token.IsKind(SyntaxKind.IdentifierToken) && 850if (token.IsKind(SyntaxKind.ColonToken) && 851token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) && 852token.GetPreviousToken(includeSkipped: true).GetPreviousToken().IsKind(SyntaxKind.WhereKeyword)) 876if (token.IsKind(SyntaxKind.CommaToken) && 895if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 907if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 920if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 1048if (token.IsKind(SyntaxKind.OpenParenToken) && 1055if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1061if (token.IsKind(SyntaxKind.CommaToken) && 1071if (token.IsKind(SyntaxKind.CommaToken) && 1080if (token.IsKind(SyntaxKind.CloseBracketToken) && 1096else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName) 1132if (token.IsKind(SyntaxKind.OpenBracketToken) || token.IsKind(SyntaxKind.CommaToken)) 1146if (token.IsKind(SyntaxKind.DelegateKeyword) && 1161if (token.IsKind(SyntaxKind.OperatorKeyword)) 1163if (token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.ImplicitKeyword) || 1164token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.ExplicitKeyword)) 1184if (token.IsKind(SyntaxKind.OpenParenToken) || 1185token.IsKind(SyntaxKind.OpenBracketToken) || 1186token.IsKind(SyntaxKind.CommaToken)) 1251else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1255else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1306if (leftToken.IsKind(SyntaxKind.CloseParenToken)) 1323if (leftToken.IsKind(SyntaxKind.IdentifierToken)) 1334if (leftToken.IsKind(SyntaxKind.IdentifierToken) && 1352if (leftToken.IsKind(SyntaxKind.OpenParenToken)) 1398if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1406if (leftToken.IsKind(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 1424if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1449if (leftToken.IsKind(SyntaxKind.DotToken)) 1510binaryExpressionSyntax.OperatorToken.IsKind(SyntaxKind.IsKeyword) && 1613if (leftToken.IsKind(SyntaxKind.OpenParenToken) && leftToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1769if (token.IsKind(SyntaxKind.ConstKeyword) && 1801if (token.IsKind(SyntaxKind.OutKeyword) && 1813if (token.IsKind(SyntaxKind.OpenParenToken)) 1816if (previous.IsKind(SyntaxKind.ForKeyword) || 1817previous.IsKind(SyntaxKind.ForEachKeyword) || 1818previous.IsKind(SyntaxKind.UsingKeyword)) 1826if (token.IsKind(SyntaxKind.UsingKeyword) && 1841if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.JoinKeyword) && 1853if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 1859if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax) 1876if (token.IsKind(SyntaxKind.OpenParenToken) && 1877token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword)) 1893if (token.IsKind(SyntaxKind.OpenParenToken) && 1894token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CatchKeyword)) 1907if (token.IsKind(SyntaxKind.IsKeyword) || 1908token.IsKind(SyntaxKind.AsKeyword)) 1921if (token.IsKind(SyntaxKind.NewKeyword)) 1975if (token.IsKind(SyntaxKind.None)) 2025if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.OpenParenToken) && 2039if (token.IsKind(SyntaxKind.OpenParenToken) && 2059if (token.IsKind(SyntaxKind.CaseKeyword) && 2065if (token.IsKind(SyntaxKind.EqualsToken) && 2102(token.IsKind(SyntaxKind.CommaToken) || 2103token.IsKind(SyntaxKind.OpenParenToken))) 2109if (token.IsKind(SyntaxKind.ColonToken) && 2117if (token.IsKind(SyntaxKind.EqualsToken) && 2188if (token.IsKind(SyntaxKind.DotToken) || 2189token.IsKind(SyntaxKind.ColonColonToken) || 2190token.IsKind(SyntaxKind.MinusGreaterThanToken)) 2197if (token.IsKind(SyntaxKind.EqualsToken)) 2219if (token.IsKind(SyntaxKind.EqualsToken) || 2220token.IsKind(SyntaxKind.MinusEqualsToken) || 2221token.IsKind(SyntaxKind.AsteriskEqualsToken) || 2222token.IsKind(SyntaxKind.PlusEqualsToken) || 2223token.IsKind(SyntaxKind.SlashEqualsToken) || 2224token.IsKind(SyntaxKind.ExclamationEqualsToken) || 2225token.IsKind(SyntaxKind.CaretEqualsToken) || 2226token.IsKind(SyntaxKind.AmpersandEqualsToken) || 2227token.IsKind(SyntaxKind.BarEqualsToken) || 2228token.IsKind(SyntaxKind.PercentEqualsToken) || 2229token.IsKind(SyntaxKind.LessThanLessThanEqualsToken) || 2230token.IsKind(SyntaxKind.GreaterThanGreaterThanEqualsToken) || 2231token.IsKind(SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken) || 2232token.IsKind(SyntaxKind.QuestionQuestionEqualsToken)) 2238if (token.IsKind(SyntaxKind.OpenParenToken)) 2313if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2330tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2333if (previousToken.IsKind(SyntaxKind.AsteriskToken) || 2334previousToken.IsKind(SyntaxKind.QuestionToken)) 2360if (token.IsKind(SyntaxKind.OpenBracketToken) || 2361token.IsKind(SyntaxKind.CommaToken)) 2371if (token.IsKind(SyntaxKind.DotDotToken) && 2379if (token.IsKind(SyntaxKind.QuestionToken) && 2388if (token.IsKind(SyntaxKind.ColonToken) && 2397if (token.IsKind(SyntaxKind.OpenParenToken)) 2419if (token.IsKind(SyntaxKind.OpenParenToken) || 2420token.IsKind(SyntaxKind.OpenBracketToken) || 2421token.IsKind(SyntaxKind.CommaToken)) 2433if (token.IsKind(SyntaxKind.OpenParenToken) || 2434token.IsKind(SyntaxKind.CommaToken)) 2447if (token.IsKind(SyntaxKind.RefKeyword) || 2448token.IsKind(SyntaxKind.InKeyword) || 2449token.IsKind(SyntaxKind.OutKeyword)) 2469if (token.IsKind(SyntaxKind.ColonToken) && 2477if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2484if (token.IsKind(SyntaxKind.OpenBraceToken) || 2485token.IsKind(SyntaxKind.CommaToken)) 2491if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2494if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2521if (token.IsKind(SyntaxKind.SemicolonToken) && 2532if (token.IsKind(SyntaxKind.OpenParenToken) && 2541if (token.IsKind(SyntaxKind.CommaToken) && 2551if (token.IsKind(SyntaxKind.InKeyword)) 2565if (token.IsKind(SyntaxKind.OnKeyword) || 2566token.IsKind(SyntaxKind.EqualsKeyword)) 2575if (token.IsKind(SyntaxKind.WhereKeyword) && 2583if (token.IsKind(SyntaxKind.OrderByKeyword) || 2584token.IsKind(SyntaxKind.CommaToken)) 2593if (token.IsKind(SyntaxKind.SelectKeyword) && 2601if (token.IsKind(SyntaxKind.GroupKeyword) || 2602token.IsKind(SyntaxKind.ByKeyword)) 2613if (token.IsKind(SyntaxKind.ReturnKeyword)) 2622if (token.IsKind(SyntaxKind.ThrowKeyword)) 2628if (token.IsKind(SyntaxKind.OpenParenToken) && 2629token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2644if (token.IsKind(SyntaxKind.OpenParenToken) && 2645token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2651if (token.IsKind(SyntaxKind.OpenParenToken) && 2652token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2658if (token.IsKind(SyntaxKind.OpenParenToken) && 2659token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2665if (token.IsKind(SyntaxKind.OpenParenToken) && 2666token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2672if (token.IsKind(SyntaxKind.OpenParenToken) && 2673token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2679if (token.IsKind(SyntaxKind.OpenParenToken) && 2680token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2686if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2703if (token.IsKind(SyntaxKind.OpenBraceToken) || token.IsKind(SyntaxKind.CommaToken)) 2726if (token.IsKind(SyntaxKind.OpenBraceToken)) 2747if (token.IsKind(SyntaxKind.DotToken)) 2819if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2862if (token.IsKind(SyntaxKind.IdentifierToken) && 2946if (token.IsKind(SyntaxKind.CloseBraceToken)) 2974if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2979if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2998token.IsKind(SyntaxKind.ColonToken) && 3009if (!token.IsKind(SyntaxKind.DotToken)) 3060return targetToken.IsKind(SyntaxKind.AsteriskToken) &&
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs\ITypeSymbolExtensions.cs (1)
100if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
NewLineUserSettingFormattingRule.cs (32)
83if (previousToken.IsKind(SyntaxKind.CloseBraceToken) 84&& currentToken.IsKind(SyntaxKind.ElseKeyword) 94if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 103if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 112if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 130if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 148if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is MemberDeclarationSyntax) 160if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 169if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 178if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 187if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 197if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 206if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 226if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 240if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 254if (previousToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.IsKind(SyntaxKind.ElseKeyword)) 268if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 281if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 294if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 307if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 323if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 340if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 349if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is MemberDeclarationSyntax) 366if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 379if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 392if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 405if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 419if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 432if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 447if (previousToken.IsKind(SyntaxKind.SemicolonToken)
Recommendations\CSharpRecommendationServiceRunner.cs (1)
350return new RecommendedSymbols(usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword)
Rename\CSharpRenameRewriterLanguageService.cs (11)
264=> token.IsKind(SyntaxKind.GetKeyword) 268=> token.IsKind(SyntaxKind.SetKeyword) 272=> token.IsKind(SyntaxKind.InitKeyword) 283token.IsKind(SyntaxKind.IdentifierToken) && 383if (!isRenameLocation && symbol is INamespaceSymbol && token.GetPreviousToken().IsKind(SyntaxKind.NamespaceKeyword)) 402if (isRenameLocation && token.GetPreviousToken().IsKind(SyntaxKind.NamespaceKeyword)) 546!token.IsKind(SyntaxKind.GlobalKeyword) && 698if (newToken.IsKind(SyntaxKind.StringLiteralToken)) 702else if (newToken.IsKind(SyntaxKind.InterpolatedStringTextToken)) 711if (newToken.IsKind(SyntaxKind.XmlTextLiteralToken)) 715else if (newToken.IsKind(SyntaxKind.IdentifierToken) && newToken.Parent.IsKind(SyntaxKind.XmlName) && newToken.ValueText == _originalText)
Simplification\CSharpSimplificationService.NodesAndTokensToReduceComputer.cs (1)
107if (_simplifyAllDescendants && !_insideSpeculatedNode && !token.IsKind(SyntaxKind.None))
Simplification\Simplifiers\NameSimplifier.cs (1)
692aliasName.Alias.Identifier.IsKind(SyntaxKind.GlobalKeyword);
SpacingFormattingRule.cs (2)
254if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 261if (currentToken.IsKind(SyntaxKind.EndOfFileToken))
SuppressFormattingRule.cs (3)
334Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None)); 347if (!pragmaWarningDirectiveTrivia.DisableOrRestoreKeyword.IsKind(disableOrRestoreKeyword))
SyntaxTriviaExtensions.cs (1)
206isDisable = pragmaWarning.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword);
TokenBasedFormattingRule.cs (7)
89if (!currentToken.IsKind(SyntaxKind.SemicolonToken) && 285if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 289if (currentToken.IsKind(SyntaxKind.OpenBracketToken)) 372if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 391if (currentToken.IsKind(SyntaxKind.ColonToken)) 451if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 464if (currentToken.IsKind(SyntaxKind.QuestionToken) &&
TriviaDataFactory.Analyzer.cs (1)
66for (var currentToken = token1; !currentToken.IsKind(SyntaxKind.None);)
TypeDeclarationSyntaxExtensions.cs (2)
100if (token.IsMissing || token.IsKind(SyntaxKind.None)) 115if (typeDeclaration.SemicolonToken.IsKind(SyntaxKind.SemicolonToken))
UsingsAndExternAliasesOrganizer.cs (2)
61var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 62var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword);
WrappingFormattingRule.cs (4)
94if (!firstToken.IsKind(SyntaxKind.None) || !lastToken.IsKind(SyntaxKind.None)) 124if (!tokens.firstToken.IsKind(SyntaxKind.None) || !tokens.lastToken.IsKind(SyntaxKind.None))
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.CodeAnalysis.EditorFeatures.Cocoa (1)
Snippets\CSharpSnippets\SnippetCommandHandler.cs (1)
114return !(trivia.IsKind(SyntaxKind.MultiLineCommentTrivia) || trivia.IsKind(SyntaxKind.SingleLineCommentTrivia) || token.IsKind(SyntaxKind.StringLiteralToken));
Microsoft.VisualStudio.LanguageServices.CSharp (29)
LanguageService\CSharpHelpContextService.cs (29)
113if (token.IsKind(SyntaxKind.InterpolatedStringStartToken) || 114token.IsKind(SyntaxKind.InterpolatedStringEndToken) || 115token.IsKind(SyntaxKind.InterpolatedRawStringEndToken) || 116token.IsKind(SyntaxKind.InterpolatedStringTextToken) || 117token.IsKind(SyntaxKind.InterpolatedSingleLineRawStringStartToken) || 118token.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 130if (token.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken)) 136if (token.IsKind(SyntaxKind.Utf8StringLiteralToken) || 137token.IsKind(SyntaxKind.Utf8SingleLineRawStringLiteralToken) || 138token.IsKind(SyntaxKind.Utf8MultiLineRawStringLiteralToken)) 144if (token.IsKind(SyntaxKind.SingleLineRawStringLiteralToken) || 145token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 166else if (token.Parent is NullableTypeSyntax && token.IsKind(SyntaxKind.QuestionToken)) 216if (token.IsKind(SyntaxKind.ExclamationToken) && 230if (token.IsKind(SyntaxKind.ColonColonToken)) 236if (token.IsKind(SyntaxKind.ColonToken) && token.Parent is NameColonSyntax) 242if (token.IsKind(SyntaxKind.EqualsToken)) 315if (token.IsKind(SyntaxKind.QuestionToken) && token.Parent is ConditionalExpressionSyntax) 321if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 348if (token.IsKind(SyntaxKind.EndOfDirectiveToken) && token.GetAncestor<RegionDirectiveTriviaSyntax>() != null) 423text = token.GetNextToken().IsKind(SyntaxKind.StaticKeyword) 441return CSharpSyntaxFacts.Instance.GetModifiers(token.Parent).Any(t => t.IsKind(kind)); 447if (token.IsKind(SyntaxKind.InKeyword)) 462if (token.IsKind(SyntaxKind.DefaultKeyword)) 483if (token.IsKind(SyntaxKind.ClassKeyword) && token.Parent is ClassOrStructConstraintSyntax) 489if (token.IsKind(SyntaxKind.StructKeyword) && token.Parent is ClassOrStructConstraintSyntax) 495if (token.IsKind(SyntaxKind.UsingKeyword) && token.Parent is UsingStatementSyntax or LocalDeclarationStatementSyntax) 501if (token.IsKind(SyntaxKind.SwitchKeyword) && token.Parent is SwitchExpressionSyntax) 513if (token.ValueText == "var" && token.IsKind(SyntaxKind.IdentifierToken) &&