105 references to WhitespaceTrivia
Microsoft.CodeAnalysis.CSharp (9)
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
95
case SyntaxKind.
WhitespaceTrivia
:
Parser\DirectiveParser.cs (1)
296
if (t.Kind == SyntaxKind.
WhitespaceTrivia
)
Syntax\InternalSyntax\SyntaxFactory.cs (1)
82
var trivia = SyntaxTrivia.Create(SyntaxKind.
WhitespaceTrivia
, text);
Syntax\SyntaxFactory.cs (2)
184
/// <see cref="SyntaxKind.
WhitespaceTrivia
"/>, <see cref="SyntaxKind.EndOfLineTrivia"/>,
205
case SyntaxKind.
WhitespaceTrivia
:
Syntax\SyntaxKindFacts.cs (1)
258
case SyntaxKind.
WhitespaceTrivia
:
Syntax\SyntaxNodeRemover.cs (1)
473
if (directiveTriviaListIndex >= 1 && triviaList[directiveTriviaListIndex - 1] is { RawKind: (int)SyntaxKind.
WhitespaceTrivia
} indentationTrivia)
Syntax\SyntaxNormalizer.cs (2)
1028
if (trivia.IsKind(SyntaxKind.
WhitespaceTrivia
) ||
1167
case SyntaxKind.
WhitespaceTrivia
:
Microsoft.CodeAnalysis.CSharp.CodeStyle (15)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
643
if (openBracket.TrailingTrivia is [(kind: SyntaxKind.
WhitespaceTrivia
), ..])
646
if (elements is [.., var lastNodeOrToken] && lastNodeOrToken.GetTrailingTrivia() is [.., (kind: SyntaxKind.
WhitespaceTrivia
)] trailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
897
while (finalTrivia is [.., (kind: SyntaxKind.
WhitespaceTrivia
)])
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
151
=> trivia.Kind() == SyntaxKind.
WhitespaceTrivia
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (3)
38
.Where(t => t is (kind: SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.
WhitespaceTrivia
))
43
=> triviaList.SkipWhile(t => t.Kind() == SyntaxKind.
WhitespaceTrivia
);
56
SyntaxKind.
WhitespaceTrivia
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (1)
38
=> trivia.RawKind == (int)SyntaxKind.
WhitespaceTrivia
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (2)
101
if (trivia.Kind() == SyntaxKind.
WhitespaceTrivia
)
155
Debug.Assert(trivia.Kind() == SyntaxKind.
WhitespaceTrivia
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (3)
48
if (trivia.Kind() == SyntaxKind.
WhitespaceTrivia
)
127
if (trivia.Kind() != SyntaxKind.
WhitespaceTrivia
)
271
trivia.Kind() == SyntaxKind.
WhitespaceTrivia
||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
482
return trivia.Kind() is SyntaxKind.
WhitespaceTrivia
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxKinds.cs (1)
29
public int WhitespaceTrivia => (int)SyntaxKind.
WhitespaceTrivia
;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (9)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
107
if (finalLeadingTrivia is [.., (kind: SyntaxKind.
WhitespaceTrivia
)])
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
313
if (leadingTrivia is [(kind: SyntaxKind.
WhitespaceTrivia
), (kind: SyntaxKind.EndOfLineTrivia), ..])
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
106
return previousToken.TrailingTrivia.All(t => t.Kind() == SyntaxKind.
WhitespaceTrivia
)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
609
if (token.LeadingTrivia is not [.., (kind: SyntaxKind.
WhitespaceTrivia
)])
860
while (index - 1 >= 0 && trivia[index - 1].Kind() == SyntaxKind.
WhitespaceTrivia
)
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (1)
47
protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.Kind() is SyntaxKind.
WhitespaceTrivia
or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
43
Matcher.Repeat(Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.
WhitespaceTrivia
, "whitespace")),
376
=> node.GetLeadingTrivia() is [.., (kind: SyntaxKind.
WhitespaceTrivia
) whitespace] ? whitespace.ToString() : "";
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (1)
132
var insertionIndex = leadingTrivia is [.., (kind: SyntaxKind.
WhitespaceTrivia
)]
Microsoft.CodeAnalysis.CSharp.Features (29)
ChangeSignature\CSharpChangeSignatureService.cs (2)
679
var oldOnlyHasWhitespaceTrivia = oldTrivia.All(t => t.IsKind(SyntaxKind.
WhitespaceTrivia
));
682
var newOnlyHasWhitespaceTrivia = newTrivia.All(t => t.IsKind(SyntaxKind.
WhitespaceTrivia
));
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
197
case SyntaxKind.
WhitespaceTrivia
:
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (2)
325
.SkipWhile(t => t.IsKind(SyntaxKind.
WhitespaceTrivia
))
331
.SkipWhile(t => t is (kind: SyntaxKind.
WhitespaceTrivia
or SyntaxKind.EndOfLineTrivia))
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (1)
71
nameEquals.Name.GetTrailingTrivia() is [(kind: SyntaxKind.
WhitespaceTrivia
)]
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
226
namespaceDeclaration.GetLeadingTrivia().TakeWhile(t => t.Kind() is SyntaxKind.
WhitespaceTrivia
or SyntaxKind.EndOfLineTrivia));
ExtractMethod\CSharpMethodExtractor.Analyzer.cs (1)
17
private static readonly HashSet<int> s_nonNoisySyntaxKindSet = [(int)SyntaxKind.
WhitespaceTrivia
, (int)SyntaxKind.EndOfLineTrivia];
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (1)
214
if (trivia.Kind() is not SyntaxKind.
WhitespaceTrivia
and
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (1)
33
: base(document, result, (int)SyntaxKind.EndOfLineTrivia, (int)SyntaxKind.
WhitespaceTrivia
)
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
502
if (nextStatementLeading is [(kind: SyntaxKind.
WhitespaceTrivia
) indentation])
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
129
else if (trivia.Kind() is not SyntaxKind.
WhitespaceTrivia
and not SyntaxKind.EndOfLineTrivia)
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
104
typeDeclaration.CloseBraceToken.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.
WhitespaceTrivia
, indentationString)));
Snippets\CSharpIntMainSnippetProvider.cs (1)
60
var updatedReturnStatement = returnStatement.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.
WhitespaceTrivia
, indentationString));
Snippets\CSharpSnippetHelpers.cs (1)
55
var updatedBlock = block.WithCloseBraceToken(block.CloseBraceToken.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.
WhitespaceTrivia
, indentationString)));
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
643
if (openBracket.TrailingTrivia is [(kind: SyntaxKind.
WhitespaceTrivia
), ..])
646
if (elements is [.., var lastNodeOrToken] && lastNodeOrToken.GetTrailingTrivia() is [.., (kind: SyntaxKind.
WhitespaceTrivia
)] trailingTrivia)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
107
if (finalLeadingTrivia is [.., (kind: SyntaxKind.
WhitespaceTrivia
)])
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
313
if (leadingTrivia is [(kind: SyntaxKind.
WhitespaceTrivia
), (kind: SyntaxKind.EndOfLineTrivia), ..])
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
106
return previousToken.TrailingTrivia.All(t => t.Kind() == SyntaxKind.
WhitespaceTrivia
)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
609
if (token.LeadingTrivia is not [.., (kind: SyntaxKind.
WhitespaceTrivia
)])
860
while (index - 1 >= 0 && trivia[index - 1].Kind() == SyntaxKind.
WhitespaceTrivia
)
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (1)
47
protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.Kind() is SyntaxKind.
WhitespaceTrivia
or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
43
Matcher.Repeat(Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.
WhitespaceTrivia
, "whitespace")),
376
=> node.GetLeadingTrivia() is [.., (kind: SyntaxKind.
WhitespaceTrivia
) whitespace] ? whitespace.ToString() : "";
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (1)
132
var insertionIndex = leadingTrivia is [.., (kind: SyntaxKind.
WhitespaceTrivia
)]
Structure\CSharpStructureHelpers.cs (2)
74
else if (!trivia.IsKind(SyntaxKind.
WhitespaceTrivia
))
188
SyntaxKind.
WhitespaceTrivia
or SyntaxKind.EndOfLineTrivia or SyntaxKind.EndOfFileToken))
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
153
var indentation = leadingTrivia is [.., (kind: SyntaxKind.
WhitespaceTrivia
) whitespaceTrivia]
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (25)
LexicalAndXml\LexicalTests.cs (13)
3619
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, leading[0].Kind());
3625
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, trailing[0].Kind());
3637
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, leading[0].Kind());
3643
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, trailing[0].Kind());
3658
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, leading[0].Kind());
3664
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, trailing[0].Kind());
3840
Assert.True(token.LeadingTrivia.Single().Kind() == SyntaxKind.
WhitespaceTrivia
);
3868
Assert.True(token.LeadingTrivia.Single().Kind() == SyntaxKind.
WhitespaceTrivia
);
3899
Assert.True(token.LeadingTrivia.Single().Kind() == SyntaxKind.
WhitespaceTrivia
);
3922
Assert.True(token.LeadingTrivia.Single().Kind() == SyntaxKind.
WhitespaceTrivia
);
3940
Assert.True(token.LeadingTrivia.Single().Kind() == SyntaxKind.
WhitespaceTrivia
);
4079
Assert.True(token.LeadingTrivia.Single().Kind() == SyntaxKind.
WhitespaceTrivia
);
4245
Assert.True(token.LeadingTrivia.Single().Kind() == SyntaxKind.
WhitespaceTrivia
);
LexicalAndXml\SyntaxTokenParserTests.cs (2)
298
(SyntaxKind.
WhitespaceTrivia
, " "));
376
(SyntaxKind.
WhitespaceTrivia
, " "));
Parsing\ScriptParsingTests.cs (1)
9653
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, leading[1].Kind());
Syntax\StructuredTriviaTests.cs (1)
82
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, trResult.Kind());
Syntax\SyntaxNodeTests.cs (7)
633
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[2].Kind());
634
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[3].Kind());
651
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[3].Kind());
653
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[5].Kind());
654
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[6].Kind());
2382
var deepTrivia = expr.GetDirectives().SelectMany(d => d.DescendantTrivia().Where(tr => tr.Kind() == SyntaxKind.
WhitespaceTrivia
)).ToList();
2406
var trivia = expr.DescendantTrivia().Where(tr => tr.IsKind(SyntaxKind.
WhitespaceTrivia
)).ToList();
Syntax\SyntaxRewriterTests.cs (1)
200
trivia.Kind() == SyntaxKind.
WhitespaceTrivia
? default(SyntaxTrivia) : trivia);
Microsoft.CodeAnalysis.CSharp.Workspaces (15)
Classification\Worker_Preprocesser.cs (1)
85
if (trivia.Kind() == SyntaxKind.
WhitespaceTrivia
)
Simplification\CSharpSimplificationService.Expander.cs (1)
33
private static readonly SyntaxTrivia s_oneWhitespaceSeparator = SyntaxTrivia(SyntaxKind.
WhitespaceTrivia
, " ");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
897
while (finalTrivia is [.., (kind: SyntaxKind.
WhitespaceTrivia
)])
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
151
=> trivia.Kind() == SyntaxKind.
WhitespaceTrivia
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (3)
38
.Where(t => t is (kind: SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.
WhitespaceTrivia
))
43
=> triviaList.SkipWhile(t => t.Kind() == SyntaxKind.
WhitespaceTrivia
);
56
SyntaxKind.
WhitespaceTrivia
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (1)
38
=> trivia.RawKind == (int)SyntaxKind.
WhitespaceTrivia
;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (2)
101
if (trivia.Kind() == SyntaxKind.
WhitespaceTrivia
)
155
Debug.Assert(trivia.Kind() == SyntaxKind.
WhitespaceTrivia
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (3)
48
if (trivia.Kind() == SyntaxKind.
WhitespaceTrivia
)
127
if (trivia.Kind() != SyntaxKind.
WhitespaceTrivia
)
271
trivia.Kind() == SyntaxKind.
WhitespaceTrivia
||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
482
return trivia.Kind() is SyntaxKind.
WhitespaceTrivia
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxKinds.cs (1)
29
public int WhitespaceTrivia => (int)SyntaxKind.
WhitespaceTrivia
;
Microsoft.VisualStudio.LanguageServices.CSharp (3)
CodeModel\CSharpCodeModelService.cs (2)
1231
else if (trivia.Kind() is not SyntaxKind.
WhitespaceTrivia
and
2869
else if (trivia.Kind() != SyntaxKind.
WhitespaceTrivia
)
CodeModel\CSharpCodeModelService.NodeLocator.cs (1)
163
.Where(t => t is not SyntaxTrivia(SyntaxKind.
WhitespaceTrivia
or SyntaxKind.EndOfLineTrivia))