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