98 references to WhitespaceTrivia
Microsoft.CodeAnalysis.CSharp (8)
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
95
case SyntaxKind.
WhitespaceTrivia
:
Parser\DirectiveParser.cs (1)
304
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\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)
727
if (openBracket.TrailingTrivia is [(kind: SyntaxKind.
WhitespaceTrivia
), ..])
730
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 (7)
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 (1)
333
=> 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 (25)
ChangeSignature\CSharpChangeSignatureService.cs (2)
677
var oldOnlyHasWhitespaceTrivia = oldTrivia.All(t => t.IsKind(SyntaxKind.
WhitespaceTrivia
));
680
var newOnlyHasWhitespaceTrivia = newTrivia.All(t => t.IsKind(SyntaxKind.
WhitespaceTrivia
));
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
197
case SyntaxKind.
WhitespaceTrivia
:
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (2)
329
.SkipWhile(t => t.IsKind(SyntaxKind.
WhitespaceTrivia
))
335
.SkipWhile(t => t is (kind: SyntaxKind.
WhitespaceTrivia
or SyntaxKind.EndOfLineTrivia))
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
226
namespaceDeclaration.GetLeadingTrivia().TakeWhile(t => t.Kind() is SyntaxKind.
WhitespaceTrivia
or SyntaxKind.EndOfLineTrivia));
ExtractMethod\CSharpMethodExtractor.Analyzer.cs (1)
19
private static readonly HashSet<int> s_nonNoisySyntaxKindSet = new HashSet<int>([(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
)
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)
727
if (openBracket.TrailingTrivia is [(kind: SyntaxKind.
WhitespaceTrivia
), ..])
730
if (elements is [.., var lastNodeOrToken] && lastNodeOrToken.GetTrailingTrivia() is [.., (kind: SyntaxKind.
WhitespaceTrivia
)] trailingTrivia)
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 (1)
333
=> 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)
152
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)
610
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[2].Kind());
611
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[3].Kind());
628
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[3].Kind());
630
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[5].Kind());
631
Assert.Equal(SyntaxKind.
WhitespaceTrivia
, list[6].Kind());
2359
var deepTrivia = expr.GetDirectives().SelectMany(d => d.DescendantTrivia().Where(tr => tr.Kind() == SyntaxKind.
WhitespaceTrivia
)).ToList();
2383
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))