407 references to Kind
Microsoft.CodeAnalysis.CSharp (23)
Compilation\CSharpCompilation.cs (2)
4442
Func<SyntaxTrivia, bool> isComment = trivia => trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia || trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia;
Compiler\DocumentationCommentCompiler.cs (1)
267
if (trivia.
Kind
() is SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia)
Compiler\UnprocessedDocumentationCommentFinder.cs (1)
100
if (!_isValidLocation && SyntaxFacts.IsDocumentationCommentTrivia(trivia.
Kind
()))
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
66
switch (trivia.
Kind
())
Syntax\CSharpSyntaxNode.cs (1)
403
if (!SyntaxFacts.IsDocumentationCommentTrivia(trivia.
Kind
()))
Syntax\CSharpSyntaxRewriter.cs (1)
301
if (alternate != null && visited.
Kind
() != SyntaxKind.None)
Syntax\CSharpSyntaxTree.cs (2)
746
isComment: trivia => trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia || trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia,
Syntax\SyntaxFactory.cs (1)
2405
if (trivia.ContainsDiagnostics && trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia)
Syntax\SyntaxNodeRemover.cs (3)
128
return trivia.
Kind
() == SyntaxKind.EndOfLineTrivia
129
|| trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia
140
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
Syntax\SyntaxNormalizer.cs (10)
134
t => t.
Kind
() == SyntaxKind.SkippedTokensTrivia);
1164
switch (trivia.
Kind
())
1171
return !SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
());
1183
var kind = trivia.
Kind
();
1195
var kind = trivia.
Kind
();
1209
switch (trivia.
Kind
())
1229
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
1234
if (trivia.
Kind
() == SyntaxKind.PreprocessingMessageTrivia || trivia.
Kind
() == SyntaxKind.DisabledTextTrivia)
1291
if (SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
()))
Microsoft.CodeAnalysis.CSharp.CodeStyle (68)
ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
99
if (nextToken.LeadingTrivia.Any(static t => t.
Kind
() is
ConditionalExpressionPlacementDiagnosticAnalyzer.cs (1)
103
if (nextToken.LeadingTrivia.Any(static t => t.
Kind
() is
ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
78
if (colonToken.TrailingTrivia.Last().
Kind
() != SyntaxKind.EndOfLineTrivia)
ConvertProgramAnalysis_ProgramMain.cs (1)
72
var lastPragma = root.GetFirstToken().LeadingTrivia.LastOrDefault(t => t.
Kind
() is SyntaxKind.PragmaWarningDirectiveTrivia);
CSharpFileHeaderHelper.cs (1)
48
throw ExceptionUtilities.UnexpectedValue(commentTrivia.
Kind
());
CSharpSyntaxFacts.cs (4)
1097
if (trivia.
Kind
() == SyntaxKind.DisabledTextTrivia)
1216
=> trivia.
Kind
() == SyntaxKind.DocumentationCommentExteriorTrivia;
1369
=> SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
());
1433
throw ExceptionUtilities.UnexpectedValue(trivia.
Kind
());
CSharpTriviaFormatter.cs (8)
87
if (SyntaxFacts.IsPreprocessorDirective(trivia2.
Kind
()))
149
if (!trivia1.IsKind(trivia2.
Kind
()) || trivia2.IsMultiLineComment() || trivia2.IsMultiLineDocComment() || existingWhitespaceBetween.Lines > 1)
199
var isStartOrEndOfFile = (this.Token1.RawKind == 0 || this.Token2.RawKind == 0) && (trivia1.
Kind
() == 0 || trivia2.
Kind
() == 0);
200
var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.
Kind
() == 0);
210
if (trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia)
324
if (trivia.
Kind
() == SyntaxKind.SkippedTokensTrivia)
353
if (trivia.
Kind
() == SyntaxKind.SkippedTokensTrivia)
CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (1)
35
if (trivia.
Kind
() == SyntaxKind.DocumentationCommentExteriorTrivia)
DirectiveSyntaxExtensions.DirectiveWalker.cs (1)
59
switch (directive.
Kind
())
ElasticTriviaFormattingRule.cs (1)
474
return trivia.
Kind
() is SyntaxKind.WhitespaceTrivia
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (5)
302
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
308
return trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia;
316
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
342
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
514
if (trivia.
Kind
() == SyntaxKind.DisabledTextTrivia)
SyntaxNodeExtensions.cs (1)
684
var hasLeadingDirective = node.GetLeadingTrivia().Any(t => SyntaxFacts.IsPreprocessorDirective(t.
Kind
()));
SyntaxTriviaExtensions.cs (11)
22
=> kind = trivia.
Kind
();
37
=> trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia;
40
=> trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia;
43
=> trivia.
Kind
() == SyntaxKind.ShebangDirectiveTrivia;
47
if (trivia.
Kind
() != SyntaxKind.MultiLineCommentTrivia)
58
=> trivia.
Kind
() == SyntaxKind.SingleLineDocumentationCommentTrivia;
61
=> trivia.
Kind
() == SyntaxKind.MultiLineDocumentationCommentTrivia;
66
if (trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia)
75
else if (trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia)
148
=> trivia.
Kind
() == SyntaxKind.EndOfLineTrivia;
151
=> trivia.
Kind
() == SyntaxKind.WhitespaceTrivia;
SyntaxTriviaListExtensions.cs (4)
20
.Where(t => t.
Kind
() == SyntaxKind.EndOfLineTrivia)
39
=> triviaList.SkipWhile(t => t.
Kind
() == SyntaxKind.WhitespaceTrivia);
48
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
51
t.
Kind
() is SyntaxKind.EndOfLineTrivia or
TriviaDataFactory.Analyzer.cs (7)
101
if (trivia.
Kind
() == SyntaxKind.WhitespaceTrivia)
105
else if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
113
else if (trivia.
Kind
() == SyntaxKind.SkippedTokensTrivia)
117
else if (trivia.
Kind
() is SyntaxKind.DisabledTextTrivia or
122
else if (trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia)
128
Contract.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
()));
155
Debug.Assert(trivia.
Kind
() == SyntaxKind.WhitespaceTrivia);
TriviaDataFactory.CodeShapeAnalyzer.cs (16)
38
Contract.ThrowIfTrue(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
39
Contract.ThrowIfTrue(trivia.
Kind
() == SyntaxKind.SkippedTokensTrivia);
40
Contract.ThrowIfTrue(trivia.
Kind
() == SyntaxKind.PreprocessingMessageTrivia);
48
if (trivia.
Kind
() == SyntaxKind.WhitespaceTrivia)
65
if (trivia.
Kind
() == SyntaxKind.RegionDirectiveTrivia ||
66
trivia.
Kind
() == SyntaxKind.EndRegionDirectiveTrivia ||
67
SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
()))
80
if (trivia.
Kind
() is SyntaxKind.SkippedTokensTrivia or
127
if (trivia.
Kind
() != SyntaxKind.WhitespaceTrivia)
156
if (trivia.
Kind
() != SyntaxKind.EndOfLineTrivia)
215
if (trivia.
Kind
() is not SyntaxKind.SkippedTokensTrivia and
226
if (trivia.
Kind
() is not SyntaxKind.RegionDirectiveTrivia and
248
if (!SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
()))
271
trivia.
Kind
() == SyntaxKind.WhitespaceTrivia ||
272
trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
334
if (xmlTrivia.
Kind
() == SyntaxKind.DocumentationCommentExteriorTrivia)
TriviaRewriter.cs (1)
120
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
UseExpressionBodyHelper`1.cs (1)
231
.Where(t => t.
Kind
() != SyntaxKind.EndOfLineTrivia)
UsingsAndExternAliasesOrganizer.cs (2)
159
if (!trailingTrivia.Any() || trailingTrivia.Last().
Kind
() != SyntaxKind.EndOfLineTrivia)
177
=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.
Kind
() == SyntaxKind.EndOfLineTrivia));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
ConstructorInitializerPlacementCodeFixProvider.cs (1)
110
return previousToken.TrailingTrivia.All(t => t.
Kind
() == SyntaxKind.WhitespaceTrivia)
CSharpCodeGenerationHelpers.cs (2)
92
if (t1.
Kind
() == SyntaxKind.MultiLineCommentTrivia)
100
else if (t1.
Kind
() == SyntaxKind.SkippedTokensTrivia)
CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
58
if (firstTrivia.
Kind
() != SyntaxKind.SkippedTokensTrivia)
CSharpUseCompoundAssignmentCodeFixProvider.cs (1)
52
protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.
Kind
() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Diagnostics\Suppression\SuppressionTests.cs (1)
1109
foreach (var trivia in context.Node.DescendantTrivia().Where(t => t.
Kind
() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia))
Microsoft.CodeAnalysis.CSharp.Features (28)
AddFileBanner\CSharpAddFileBannerCodeRefactoringProvider.cs (1)
27
switch (trivia.
Kind
())
ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
99
if (nextToken.LeadingTrivia.Any(static t => t.
Kind
() is
BraceMatching\BlockCommentBraceMatcher.cs (2)
31
if (trivia.
Kind
() is SyntaxKind.MultiLineCommentTrivia &&
36
else if (trivia.
Kind
() is SyntaxKind.MultiLineDocumentationCommentTrivia)
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (1)
222
if (trivia.
Kind
() == SyntaxKind.PragmaWarningDirectiveTrivia)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
187
switch (list[i].
Kind
())
ConditionalExpressionPlacementDiagnosticAnalyzer.cs (1)
103
if (nextToken.LeadingTrivia.Any(static t => t.
Kind
() is
ConstructorInitializerPlacementCodeFixProvider.cs (1)
110
return previousToken.TrailingTrivia.All(t => t.
Kind
() == SyntaxKind.WhitespaceTrivia)
ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
78
if (colonToken.TrailingTrivia.Last().
Kind
() != SyntaxKind.EndOfLineTrivia)
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (2)
161
c => c.
Kind
() is SyntaxKind.SingleLineCommentTrivia && c.ToString().Contains("https://aka.ms/new-console-template"));
168
while (commentIndex < leadingTrivia.Count && leadingTrivia[commentIndex].
Kind
() is SyntaxKind.EndOfLineTrivia)
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (2)
222
if (!statements[0].GetLeadingTrivia().Any(t => t.
Kind
() is SyntaxKind.EndOfLineTrivia) &&
226
namespaceDeclaration.GetLeadingTrivia().TakeWhile(t => t.
Kind
() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia));
ConvertProgramAnalysis_ProgramMain.cs (1)
72
var lastPragma = root.GetFirstToken().LeadingTrivia.LastOrDefault(t => t.
Kind
() is SyntaxKind.PragmaWarningDirectiveTrivia);
CSharpFileHeaderHelper.cs (1)
48
throw ExceptionUtilities.UnexpectedValue(commentTrivia.
Kind
());
CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
58
if (firstTrivia.
Kind
() != SyntaxKind.SkippedTokensTrivia)
CSharpUseCompoundAssignmentCodeFixProvider.cs (1)
52
protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.
Kind
() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (2)
353
&& firstTextToken.LeadingTrivia.ElementAt(0).
Kind
() == SyntaxKind.DocumentationCommentExteriorTrivia
362
=> token.TrailingTrivia.Any(t => t.
Kind
() == SyntaxKind.SkippedTokensTrivia);
DocumentationComments\DocCommentConverter.cs (1)
54
if (trivia.
Kind
() == SyntaxKind.SingleLineDocumentationCommentTrivia)
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (1)
213
if (trivia.
Kind
() is not SyntaxKind.WhitespaceTrivia and
ExtractMethod\Extensions.cs (1)
185
switch (trivia.
Kind
())
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
425
var precedingEndOfLine = nextStatementLeading.LastOrDefault(t => t.
Kind
() == SyntaxKind.EndOfLineTrivia);
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
237
if (trivia.
Kind
() is SyntaxKind.MultiLineDocumentationCommentTrivia or
Structure\Providers\DisabledTextTriviaStructureProvider.cs (1)
92
switch (currentTrivia.
Kind
())
TaskList\CSharpTaskListService.cs (2)
85
return trivia.
Kind
() != SyntaxKind.RegionDirectiveTrivia &&
86
SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
()) && trivia.ToString().IndexOf(SingleLineCommentPrefix, StringComparison.Ordinal) > 0;
UseExpressionBodyHelper`1.cs (1)
231
.Where(t => t.
Kind
() != SyntaxKind.EndOfLineTrivia)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (200)
LexicalAndXml\LexicalTests.cs (100)
115
Assert.Equal(SyntaxKind.SingleLineCommentTrivia, trivia[0].
Kind
());
134
Assert.Equal(SyntaxKind.SingleLineCommentTrivia, trivia[0].
Kind
());
153
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, trivia[0].
Kind
());
171
Assert.Equal(SyntaxKind.SingleLineCommentTrivia, trivia.
Kind
());
193
Assert.Equal(SyntaxKind.MultiLineCommentTrivia, trivia[0].
Kind
());
215
Assert.Equal(SyntaxKind.MultiLineCommentTrivia, trivia[0].
Kind
());
237
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, trivia[0].
Kind
());
255
Assert.Equal(SyntaxKind.MultiLineCommentTrivia, trivia[0].
Kind
());
277
Assert.Equal(SyntaxKind.SingleLineCommentTrivia, trivia[0].
Kind
());
3204
Assert.Equal(SyntaxKind.WhitespaceTrivia, leading[0].
Kind
());
3210
Assert.Equal(SyntaxKind.WhitespaceTrivia, trailing[0].
Kind
());
3222
Assert.Equal(SyntaxKind.WhitespaceTrivia, leading[0].
Kind
());
3228
Assert.Equal(SyntaxKind.WhitespaceTrivia, trailing[0].
Kind
());
3243
Assert.Equal(SyntaxKind.WhitespaceTrivia, leading[0].
Kind
());
3249
Assert.Equal(SyntaxKind.WhitespaceTrivia, trailing[0].
Kind
());
3425
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.WhitespaceTrivia);
3436
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3453
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.WhitespaceTrivia);
3462
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3484
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.WhitespaceTrivia);
3507
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.WhitespaceTrivia);
3525
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.WhitespaceTrivia);
3535
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3542
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3555
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3564
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3569
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
3579
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3588
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3592
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
3600
Assert.True(trivia1.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3609
Assert.True(trivia2.
Kind
() == SyntaxKind.EndOfLineTrivia);
3614
Assert.True(trivia3.
Kind
() == SyntaxKind.DisabledTextTrivia);
3619
Assert.True(trivia4.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3633
Assert.True(trivia1.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3642
Assert.True(trivia2.
Kind
() == SyntaxKind.EndOfLineTrivia);
3647
Assert.True(trivia3.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3664
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.WhitespaceTrivia);
3674
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3681
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3689
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3693
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3698
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
3708
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3712
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3716
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
3724
Assert.True(trivia1.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3728
Assert.True(trivia2.
Kind
() == SyntaxKind.EndOfLineTrivia);
3733
Assert.True(trivia3.
Kind
() == SyntaxKind.DisabledTextTrivia);
3738
Assert.True(trivia4.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3759
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3765
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3768
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
3777
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3799
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3805
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3808
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
3817
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3830
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.WhitespaceTrivia);
3840
Assert.True(token.LeadingTrivia.Single().
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3847
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3862
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3870
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3873
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
3885
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3893
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3896
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
3907
Assert.True(trivia1.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3915
Assert.True(trivia2.
Kind
() == SyntaxKind.EndOfLineTrivia);
3918
Assert.True(trivia3.
Kind
() == SyntaxKind.DisabledTextTrivia);
3921
Assert.True(trivia4.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3936
Assert.True(trivia1.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3944
Assert.True(trivia2.
Kind
() == SyntaxKind.EndOfLineTrivia);
3947
Assert.True(trivia3.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3968
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3974
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3977
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
3983
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
3986
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4007
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4013
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
4016
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
4023
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4029
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
4032
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
4039
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4063
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4069
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
4072
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
4079
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4085
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
4088
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
4097
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4121
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4127
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
4130
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
4139
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
4145
Assert.True(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
4148
Assert.True(trivia.
Kind
() == SyntaxKind.DisabledTextTrivia);
4155
Assert.True(trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia);
LexicalAndXml\PreprocessorTests.cs (10)
2106
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2128
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2216
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2237
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2258
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2279
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2300
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2321
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2342
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
2363
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, regionText.
Kind
());
LexicalAndXml\XmlDocCommentTests.cs (60)
82
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
101
Assert.Equal(SyntaxKind.SingleLineCommentTrivia, leading[0].
Kind
());
118
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, leading[0].
Kind
());
119
Assert.Equal(SyntaxKind.SingleLineCommentTrivia, leading[1].
Kind
());
133
Assert.Equal(SyntaxKind.MultiLineCommentTrivia, leading[0].
Kind
());
151
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
172
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
197
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
219
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
242
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
265
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
292
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
320
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
344
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
369
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
395
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
422
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
449
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
477
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
506
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
536
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
565
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
595
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
626
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
649
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
671
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
693
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
715
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
737
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
757
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
791
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
824
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
855
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
883
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
908
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
934
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
959
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
986
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1017
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1045
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1070
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1095
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1122
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1155
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1186
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1212
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1239
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1267
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1312
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1336
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1361
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1385
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1410
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1434
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1459
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1483
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1563
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1591
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
1619
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, node.
Kind
());
1645
Assert.Equal(SyntaxKind.MultiLineDocumentationCommentTrivia, node.
Kind
());
Parsing\ScriptParsingTests.cs (5)
9656
Assert.Equal(SyntaxKind.ShebangDirectiveTrivia, leading[0].
Kind
());
9657
Assert.Equal(SyntaxKind.WhitespaceTrivia, leading[1].
Kind
());
9717
Assert.Equal(SyntaxKind.SingleLineCommentTrivia, eof.GetLeadingTrivia().Single().
Kind
());
9730
Assert.Equal(SyntaxKind.ShebangDirectiveTrivia, trivia.
Kind
());
9745
Assert.Equal(SyntaxKind.PreprocessingMessageTrivia, skippedText.
Kind
());
Parsing\StatementParsingTests.cs (1)
1963
Assert.Equal(SyntaxKind.SkippedTokensTrivia, fs.ForEachKeyword.TrailingTrivia[0].
Kind
());
Syntax\StructuredTriviaTests.cs (3)
82
Assert.Equal(SyntaxKind.WhitespaceTrivia, trResult.
Kind
());
167
var trivia = tree.GetCompilationUnitRoot().DescendantTrivia().Single(t => t.
Kind
() == SyntaxKind.SingleLineDocumentationCommentTrivia);
183
var trivia = tree.GetCompilationUnitRoot().DescendantTrivia().Single(t => t.
Kind
() == SyntaxKind.MultiLineDocumentationCommentTrivia);
Syntax\SyntaxNodeTests.cs (18)
608
Assert.Equal(SyntaxKind.SingleLineCommentTrivia, list[0].
Kind
());
609
Assert.Equal(SyntaxKind.EndOfLineTrivia, list[1].
Kind
());
610
Assert.Equal(SyntaxKind.WhitespaceTrivia, list[2].
Kind
());
611
Assert.Equal(SyntaxKind.WhitespaceTrivia, list[3].
Kind
());
625
Assert.Equal(SyntaxKind.EndOfLineTrivia, list[0].
Kind
());
626
Assert.Equal(SyntaxKind.SingleLineDocumentationCommentTrivia, list[1].
Kind
());
627
Assert.Equal(SyntaxKind.DocumentationCommentExteriorTrivia, list[2].
Kind
());
628
Assert.Equal(SyntaxKind.WhitespaceTrivia, list[3].
Kind
());
629
Assert.Equal(SyntaxKind.DocumentationCommentExteriorTrivia, list[4].
Kind
());
630
Assert.Equal(SyntaxKind.WhitespaceTrivia, list[5].
Kind
());
631
Assert.Equal(SyntaxKind.WhitespaceTrivia, list[6].
Kind
());
766
Assert.Equal(SyntaxKind.None, trivia.
Kind
());
1330
Assert.Equal(SyntaxKind.DefineDirectiveTrivia, trivia.
Kind
());
1341
Assert.Equal(SyntaxKind.DefineDirectiveTrivia, trivia.
Kind
());
1345
Assert.NotEqual(SyntaxKind.None, parentTrivia.
Kind
());
2348
var deepTrivia = expr.GetDirectives().SelectMany(d => d.DescendantTrivia().Where(tr => tr.
Kind
() == SyntaxKind.WhitespaceTrivia)).ToList();
2384
Assert.Equal(SyntaxKind.MultiLineCommentTrivia, comment1.
Kind
());
2406
Assert.Equal(SyntaxKind.MultiLineCommentTrivia, comment1.
Kind
());
Syntax\SyntaxRewriterTests.cs (3)
200
trivia.
Kind
() == SyntaxKind.WhitespaceTrivia ? default(SyntaxTrivia) : trivia);
470
Assert.Equal(SyntaxKind.MultiLineCommentTrivia, comment1.
Kind
());
497
Assert.Equal(SyntaxKind.MultiLineCommentTrivia, comment1.
Kind
());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
492
if (trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia)
Microsoft.CodeAnalysis.CSharp.Workspaces (70)
Classification\Worker.cs (3)
179
switch (trivia.
Kind
())
252
triviaList[index - 1].
Kind
() == SyntaxKind.EndOfLineTrivia &&
253
triviaList[index - 2].
Kind
() == SyntaxKind.ConflictMarkerTrivia)
Classification\Worker_DocumentationComments.cs (1)
70
switch (t.
Kind
())
Classification\Worker_Preprocesser.cs (2)
85
if (trivia.
Kind
() == SyntaxKind.WhitespaceTrivia)
101
if (allowComments && trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia)
CSharpCodeGenerationHelpers.cs (2)
92
if (t1.
Kind
() == SyntaxKind.MultiLineCommentTrivia)
100
else if (t1.
Kind
() == SyntaxKind.SkippedTokensTrivia)
CSharpSyntaxFacts.cs (4)
1097
if (trivia.
Kind
() == SyntaxKind.DisabledTextTrivia)
1216
=> trivia.
Kind
() == SyntaxKind.DocumentationCommentExteriorTrivia;
1369
=> SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
());
1433
throw ExceptionUtilities.UnexpectedValue(trivia.
Kind
());
CSharpTriviaFormatter.cs (8)
87
if (SyntaxFacts.IsPreprocessorDirective(trivia2.
Kind
()))
149
if (!trivia1.IsKind(trivia2.
Kind
()) || trivia2.IsMultiLineComment() || trivia2.IsMultiLineDocComment() || existingWhitespaceBetween.Lines > 1)
199
var isStartOrEndOfFile = (this.Token1.RawKind == 0 || this.Token2.RawKind == 0) && (trivia1.
Kind
() == 0 || trivia2.
Kind
() == 0);
200
var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.
Kind
() == 0);
210
if (trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia)
324
if (trivia.
Kind
() == SyntaxKind.SkippedTokensTrivia)
353
if (trivia.
Kind
() == SyntaxKind.SkippedTokensTrivia)
CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (1)
35
if (trivia.
Kind
() == SyntaxKind.DocumentationCommentExteriorTrivia)
DirectiveSyntaxExtensions.DirectiveWalker.cs (1)
59
switch (directive.
Kind
())
ElasticTriviaFormattingRule.cs (1)
474
return trivia.
Kind
() is SyntaxKind.WhitespaceTrivia
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (1)
684
var hasLeadingDirective = node.GetLeadingTrivia().Any(t => SyntaxFacts.IsPreprocessorDirective(t.
Kind
()));
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (5)
302
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
308
return trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia;
316
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
342
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
514
if (trivia.
Kind
() == SyntaxKind.DisabledTextTrivia)
SyntaxTriviaExtensions.cs (11)
22
=> kind = trivia.
Kind
();
37
=> trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia;
40
=> trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia;
43
=> trivia.
Kind
() == SyntaxKind.ShebangDirectiveTrivia;
47
if (trivia.
Kind
() != SyntaxKind.MultiLineCommentTrivia)
58
=> trivia.
Kind
() == SyntaxKind.SingleLineDocumentationCommentTrivia;
61
=> trivia.
Kind
() == SyntaxKind.MultiLineDocumentationCommentTrivia;
66
if (trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia)
75
else if (trivia.
Kind
() == SyntaxKind.MultiLineCommentTrivia)
148
=> trivia.
Kind
() == SyntaxKind.EndOfLineTrivia;
151
=> trivia.
Kind
() == SyntaxKind.WhitespaceTrivia;
SyntaxTriviaListExtensions.cs (4)
20
.Where(t => t.
Kind
() == SyntaxKind.EndOfLineTrivia)
39
=> triviaList.SkipWhile(t => t.
Kind
() == SyntaxKind.WhitespaceTrivia);
48
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
51
t.
Kind
() is SyntaxKind.EndOfLineTrivia or
TriviaDataFactory.Analyzer.cs (7)
101
if (trivia.
Kind
() == SyntaxKind.WhitespaceTrivia)
105
else if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
113
else if (trivia.
Kind
() == SyntaxKind.SkippedTokensTrivia)
117
else if (trivia.
Kind
() is SyntaxKind.DisabledTextTrivia or
122
else if (trivia.
Kind
() == SyntaxKind.ConflictMarkerTrivia)
128
Contract.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
()));
155
Debug.Assert(trivia.
Kind
() == SyntaxKind.WhitespaceTrivia);
TriviaDataFactory.CodeShapeAnalyzer.cs (16)
38
Contract.ThrowIfTrue(trivia.
Kind
() == SyntaxKind.EndOfLineTrivia);
39
Contract.ThrowIfTrue(trivia.
Kind
() == SyntaxKind.SkippedTokensTrivia);
40
Contract.ThrowIfTrue(trivia.
Kind
() == SyntaxKind.PreprocessingMessageTrivia);
48
if (trivia.
Kind
() == SyntaxKind.WhitespaceTrivia)
65
if (trivia.
Kind
() == SyntaxKind.RegionDirectiveTrivia ||
66
trivia.
Kind
() == SyntaxKind.EndRegionDirectiveTrivia ||
67
SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
()))
80
if (trivia.
Kind
() is SyntaxKind.SkippedTokensTrivia or
127
if (trivia.
Kind
() != SyntaxKind.WhitespaceTrivia)
156
if (trivia.
Kind
() != SyntaxKind.EndOfLineTrivia)
215
if (trivia.
Kind
() is not SyntaxKind.SkippedTokensTrivia and
226
if (trivia.
Kind
() is not SyntaxKind.RegionDirectiveTrivia and
248
if (!SyntaxFacts.IsPreprocessorDirective(trivia.
Kind
()))
271
trivia.
Kind
() == SyntaxKind.WhitespaceTrivia ||
272
trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
334
if (xmlTrivia.
Kind
() == SyntaxKind.DocumentationCommentExteriorTrivia)
TriviaRewriter.cs (1)
120
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
UsingsAndExternAliasesOrganizer.cs (2)
159
if (!trailingTrivia.Any() || trailingTrivia.Last().
Kind
() != SyntaxKind.EndOfLineTrivia)
177
=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.
Kind
() == SyntaxKind.EndOfLineTrivia));
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (1)
124
var skippedTrivia = namespaceDeclaration.OpenBraceToken.TrailingTrivia.Single(t => t.
Kind
() is SyntaxKind.SkippedTokensTrivia);
Microsoft.CodeAnalysis.UnitTests (2)
CommonSyntaxTests.cs (2)
117
Assert.Equal(CSharp.SyntaxKind.MultiLineCommentTrivia, CSharp.CSharpExtensions.
Kind
(csharpTrivia));
202
Assert.Equal(CSharp.SyntaxKind.None, CSharp.CSharpExtensions.
Kind
(trivia));
Microsoft.VisualStudio.LanguageServices.CSharp (8)
CodeModel\CSharpCodeModelService.cs (5)
1234
else if (trivia.
Kind
() is not SyntaxKind.WhitespaceTrivia and
1312
leadingTriviaList[firstIndex].
Kind
() == SyntaxKind.EndOfLineTrivia)
2862
if (trivia.
Kind
() == SyntaxKind.EndOfLineTrivia)
2873
else if (trivia.
Kind
() != SyntaxKind.WhitespaceTrivia)
3299
if (lastNonWhitespaceTrivia.
Kind
() == SyntaxKind.EndRegionDirectiveTrivia)
CodeModel\CSharpCodeModelService.NodeLocator.cs (1)
167
if (significantTrivia.
Kind
() != SyntaxKind.None)
CodeModel\MethodXml\MethodXmlBuilder.cs (1)
42
if (trivia.
Kind
() == SyntaxKind.SingleLineCommentTrivia)
LanguageService\CSharpHelpContextService.cs (1)
69
if (trivia.Span.IntersectsWith(span) && trivia.
Kind
() == SyntaxKind.PreprocessingMessageTrivia &&