547 references to TrailingTrivia
Microsoft.AspNetCore.App.Analyzers (2)
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
147if (HasLanguageComment(token.GetPreviousToken().TrailingTrivia, out identifier, out options))
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (1)
100var skippedToken = findSkippedToken(token.TrailingTrivia, position);
Microsoft.CodeAnalysis (17)
Syntax\CommonSyntaxNodeRemover.cs (1)
47ContainsEndOfLine(nextSeparator.TrailingTrivia, endOfLineKind);
Syntax\SeparatedSyntaxList.cs (1)
453foreach (var tr in separator.TrailingTrivia)
Syntax\SyntaxNavigator.cs (5)
267var firstToken = GetFirstToken(token.TrailingTrivia, predicate, stepInto); 286var lastToken = GetLastToken(token.TrailingTrivia, predicate, stepInto); 332token = GetNextToken(current, current.Token.TrailingTrivia, predicate, stepInto, ref returnNext); 351var token = GetPreviousToken(current, current.Token.TrailingTrivia, predicate, stepInto, ref returnPrevious); 538var firstToken = GetFirstToken(current.TrailingTrivia, predicate, stepInto!);
Syntax\SyntaxNode.cs (3)
1075return GetLastToken(includeZeroWidth: true).TrailingTrivia; 1150foreach (var trivia in token.TrailingTrivia) 1541trivia = GetTriviaThatContainsPosition(token.TrailingTrivia, position);
Syntax\SyntaxNode.Iterators.cs (1)
557foreach (var trivia in token.TrailingTrivia)
Syntax\SyntaxNodeOrToken.cs (1)
386return this.AsToken().TrailingTrivia;
Syntax\SyntaxToken.cs (4)
199public bool HasTrailingTrivia => this.TrailingTrivia.Count > 0; 454return this.WithLeadingTrivia(token.LeadingTrivia).WithTrailingTrivia(token.TrailingTrivia); 518return this.LeadingTrivia.Concat(this.TrailingTrivia); 526return this.TrailingTrivia;
Syntax\SyntaxWalker.cs (1)
85foreach (var trivia in token.TrailingTrivia)
Microsoft.CodeAnalysis.CodeStyle (23)
src\Analyzers\Core\Analyzers\NewLines\ConsecutiveStatementPlacement\AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (2)
77if (!endToken.TrailingTrivia.Any()) 80if (!_syntaxFacts.IsEndOfLineTrivia(endToken.TrailingTrivia.Last()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (4)
633var skippedToken = findSkippedToken(token.TrailingTrivia, position); 676var skippedToken = findSkippedToken(token.TrailingTrivia, position); 953triviaList = triviaList.AddRange(token.TrailingTrivia); 966triviaList = triviaList.InsertRange(0, current.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (2)
102if (!token.LeadingTrivia.Any() && !token.TrailingTrivia.Any()) 158return token.WithTrailingTrivia(token.TrailingTrivia.Concat(trivia));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
190trivia = token.TrailingTrivia.Last();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.AbstractComplexTrivia.cs (1)
132var list = new TriviaList(Token1.TrailingTrivia, Token2.LeadingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (4)
254AddRange(triviaList, this.Token1.TrailingTrivia); 293var list = new TriviaList(this.Token1.TrailingTrivia, this.Token2.LeadingTrivia); 520if (this.Token1.TrailingTrivia.Count > 0 && 521this.Token1.TrailingTrivia[0].IsElastic())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
177if (token.TrailingTrivia.Count > 0 || HasTrailingWhitespace(tokenText))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
98!IsOnSingleLine(syntaxFacts, token.TrailingTrivia, trailing)) 234SpansPreprocessorDirective(syntaxFacts, previousToken.TrailingTrivia)) 339.Concat(openParenToken.TrailingTrivia) 346.Concat(closeParenToken.TrailingTrivia); 358if (previousToken.TrailingTrivia.Count == 0 &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (3)
198AppendPartialLeadingTriviaText(token2, builder, token1.TrailingTrivia.FullSpan.End); 249foreach (var trivia in token.TrailingTrivia) 355return previousToken.TrailingTrivia.HasAnyWhitespaceElasticTrivia() || currentToken.LeadingTrivia.HasAnyWhitespaceElasticTrivia();
Microsoft.CodeAnalysis.CodeStyle.Fixes (5)
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (2)
114if (currentToken.TrailingTrivia is [.., var endOfLine, var whitespace2] && 119var trailingTrivia = currentToken.TrailingTrivia.Replace(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (2)
531var trailing = isComma(nextToken) ? nextToken.TrailingTrivia : attributeToRemove.GetTrailingTrivia(); 564.WithTrailingTrivia(modifier.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
180if (nextToken != default && !commaToken.TrailingTrivia.Any(t => t.RawKind == syntaxKinds.EndOfLineTrivia))
Microsoft.CodeAnalysis.CSharp (13)
Syntax\CSharpSyntaxNode.cs (1)
178return lastToken.TrailingTrivia;
Syntax\CSharpSyntaxWalker.cs (1)
88foreach (var tr in token.TrailingTrivia)
Syntax\SyntaxFactory.cs (3)
1147token = token.WithTrailingTrivia(token.TrailingTrivia.Add(DocumentationCommentExterior("/// "))); 1207return Token(rewrittenToken.LeadingTrivia, SyntaxKind.LessThanToken, "{", rewrittenToken.ValueText, rewrittenToken.TrailingTrivia); 1210return Token(rewrittenToken.LeadingTrivia, SyntaxKind.GreaterThanToken, "}", rewrittenToken.ValueText, rewrittenToken.TrailingTrivia);
Syntax\SyntaxNodeRemover.cs (6)
330this.AddResidualTrivia(token.TrailingTrivia); 338GetEndOfLine(token.TrailingTrivia); 387this.AddResidualTrivia(token.TrailingTrivia); 394GetEndOfLine(token.TrailingTrivia); 492: (parentToken.TrailingTrivia, parentToken.TrailingTrivia.IndexOf(trivia));
Syntax\SyntaxNormalizer.cs (1)
113token.TrailingTrivia,
Syntax\SyntaxTokenParser.cs (1)
78/// parsed trivia will be set as the <see cref="SyntaxToken.TrailingTrivia"/> of the token.
Microsoft.CodeAnalysis.CSharp.CodeStyle (27)
src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
96if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)])
src\Analyzers\CSharp\Analyzers\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementDiagnosticAnalyzer.cs (1)
77if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)])
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (3)
79if (colonToken.TrailingTrivia.Count == 0) 82if (colonToken.TrailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) 85if (colonToken.TrailingTrivia.Any(t => !t.IsWhitespaceOrEndOfLine()))
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
122=> ContainsEndOfLine(previous.TrailingTrivia) || ContainsEndOfLine(next.LeadingTrivia);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (4)
643if (openBracket.TrailingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), ..]) 644openBracket = openBracket.WithTrailingTrivia(openBracket.TrailingTrivia.Skip(1)); 671.WithPrependedLeadingTrivia(originalInitializer.OpenBraceToken.GetPreviousToken().TrailingTrivia) 680if (initializer.OpenBraceToken.GetPreviousToken().TrailingTrivia.Any(static x => x.IsSingleOrMultiLineComment()))
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
235var trailingTrivia = semicolonToken.TrailingTrivia
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
140if (semicolonToken.TrailingTrivia.Any(t => t.IsDirective))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArrowExpressionClauseSyntaxExtensions.cs (2)
43if (arrowExpression.ArrowToken.TrailingTrivia.Any(t => t.IsSingleOrMultiLineComment())) 44statement = statement.WithPrependedLeadingTrivia(arrowExpression.ArrowToken.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberAccessExpressionSyntaxExtensions.cs (1)
31.AddRange(memberAccess.OperatorToken.TrailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
85return prevToken.TrailingTrivia.Concat(token.LeadingTrivia); 524ContainsInterleavedDirective(textSpan, token.TrailingTrivia, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
42if (token.TrailingTrivia.Count > 0) 69token.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (3)
182foreach (var trivia in token.TrailingTrivia) 226token.TrailingTrivia.Concat(SyntaxNodeOrTokenExtensions.GetTrivia(trailingNodesOrTokens).Concat(trailingTrivia))).FilterComments(addElasticMarker: false)); 229=> token.WithTrailingTrivia(token.TrailingTrivia.FilterComments(addElasticMarker: true))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (3)
27Analyze(token.TrailingTrivia, ref result); 76if (previousToken.TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia)]) 84Analyze(token1.TrailingTrivia, ref result);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
185trailingTrivia = token.TrailingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
291ProcessTriviaList(list, child.AsToken().TrailingTrivia);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (36)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (4)
331if (!namespaceDeclaration.OpenBraceToken.TrailingTrivia.All(static t => t.IsWhitespace())) 332semiColon = semiColon.WithAppendedTrailingTrivia(namespaceDeclaration.OpenBraceToken.TrailingTrivia); 348.WithAppendedTrailingTrivia(namespaceDeclaration.CloseBraceToken.TrailingTrivia); 386var openBraceToken = OpenBraceToken.WithoutLeadingTrivia().WithTrailingTrivia(fileScopedNamespace.SemicolonToken.TrailingTrivia);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (2)
250Token(leading: default, SyntaxKind.SwitchKeyword, node.CloseParenToken.TrailingTrivia), 251Token(leading: default, SyntaxKind.OpenBraceToken, node.OpenBraceToken.TrailingTrivia),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
274typeDeclaration.Identifier.TrailingTrivia;
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (3)
77replacementMap[colonToken] = colonToken.WithLeadingTrivia(colonToken.LeadingTrivia.AddRange(colonToken.TrailingTrivia).AddRange(thisBaseKeyword.LeadingTrivia)) 104var allColonTrivia = colonToken.LeadingTrivia.AddRange(colonToken.TrailingTrivia); 106return previousToken.TrailingTrivia.All(t => t.Kind() == SyntaxKind.WhitespaceTrivia)
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (1)
66.WithTrailingTrivia(recordKeyword.TrailingTrivia);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
180initializer.OpenBraceToken.GetPreviousToken().TrailingTrivia.Any(static x => x.IsSingleOrMultiLineComment()); 184var additionalLeadingTrivia = initializer!.OpenBraceToken.GetPreviousToken().TrailingTrivia
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
50var trailingTrivia = statement.SemicolonToken.TrailingTrivia.Contains(static t => t.IsSingleOrMultiLineComment()) 51? statement.SemicolonToken.TrailingTrivia
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
46if (declaration.ArrowToken.TrailingTrivia.All(t => t.IsWhitespaceOrEndOfLine()) &&
src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
78=> newKeyword.TrailingTrivia.All(t => t.IsWhitespace())
src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
58InterpolatedVerbatimText, InterpolatedVerbatimText, oldStartToken.TrailingTrivia);
src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
52.WithStatement(newWhenTrueStatement.WithPrependedLeadingTrivia(ifStatement.CloseParenToken.TrailingTrivia));
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (4)
150var openBraceTrailingTrivia = blockSyntax.OpenBraceToken.TrailingTrivia; 151var usingHasEndOfLineTrivia = usingStatement.CloseParenToken.TrailingTrivia 174var closeBraceTrailingTrivia = blockSyntax.CloseBraceToken.TrailingTrivia; 205SemicolonToken).WithTrailingTrivia(usingStatement.CloseParenToken.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (3)
92var updatedToken = lastToken.ReplaceTrivia(lastToken.TrailingTrivia, 135return Literal(token.LeadingTrivia, tokenText, token.ValueText, token.TrailingTrivia); 144return Literal(token.LeadingTrivia, tokenText, token.ValueText, token.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CastExpressionSyntaxExtensions.cs (2)
18.Concat(node.OpenParenToken.TrailingTrivia) 22.Concat(node.CloseParenToken.TrailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2260(castExpression.Expression.IsMissing || castExpression.CloseParenToken.TrailingTrivia.GetFirstNewLine().HasValue))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (4)
103var trailingTrivia = appendNewLineIfMissing ? token.TrailingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.TrailingTrivia; 119typeDeclaration = typeDeclaration.WithSemicolonToken(default).WithTrailingTrivia(typeDeclaration.SemicolonToken.TrailingTrivia); 139openBrace.TrailingTrivia.Concat(closeBrace.LeadingTrivia.Take(index + 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
279.WithTrailingTrivia(propertyDeclaration.SemicolonToken.TrailingTrivia) 301return result.WithTrailingTrivia(accessorDeclaration.Body?.GetTrailingTrivia() ?? accessorDeclaration.SemicolonToken.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (1)
53syntaxToken.TrailingTrivia))
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (2)
432var newArgumentList = ArgumentList().WithTrailingTrivia(newKeywordToken.TrailingTrivia); 449var newArgumentList = ArgumentList().WithTrailingTrivia(newKeywordToken.TrailingTrivia);
Microsoft.CodeAnalysis.CSharp.Features (69)
BraceCompletion\StringLiteralBraceCompletionService.cs (1)
95while (!token.IsKind(SyntaxKind.None) && !token.TrailingTrivia.Contains(t => t.IsEndOfLine()))
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (1)
242var toggledToken = Token(currentKeyword.LeadingTrivia, toggledKeywordKind, currentKeyword.TrailingTrivia);
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
404var trailingTrivia = equalsToken.TrailingTrivia.SkipInitialWhitespace();
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (3)
463openingBuilder.AddRange(namespaceDeclaration.OpenBraceToken.TrailingTrivia); 466closingBuilder.AddRange(namespaceDeclaration.CloseBraceToken.TrailingTrivia); 470openingBuilder.AddRange(fileScopedNamespace.SemicolonToken.TrailingTrivia);
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (2)
34OpenParenToken.WithLeadingTrivia(anonCreation.NewKeyword.LeadingTrivia).WithTrailingTrivia(anonCreation.OpenBraceToken.TrailingTrivia), 49if (i == n - 1 && i < originalSeparators.Length && originalSeparators[i].TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia) newLine])
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
110.WithTrailingTrivia(((AccessorDeclarationSyntax)accessor).SemicolonToken.TrailingTrivia));
ConvertBetweenRegularAndVerbatimString\ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider.cs (2)
71trailing: startToken.TrailingTrivia); 84trailing: textToken.TrailingTrivia);
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (2)
56typeNode = typeNode.WithLeadingTrivia(castExpression.OpenParenToken.TrailingTrivia); 57var middleTrivia = castExpression.CloseParenToken.TrailingTrivia.SkipInitialWhitespace();
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (1)
55var newLeadingTrivia = asExpression.GetLeadingTrivia().AddRange(asExpression.OperatorToken.TrailingTrivia.SkipInitialWhitespace());
ConvertLinq\ConvertForEachToLinqQuery\AbstractConverter.cs (2)
89.WithCommentsFrom(ifStatement.IfKeyword.LeadingTrivia, ifStatement.IfKeyword.TrailingTrivia), 105forEachStatement.ForEachKeyword.TrailingTrivia,
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
195i == 0 ? localDeclarationLeadingTrivia : separators[i - 1].TrailingTrivia,
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
696token.TrailingTrivia);
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (2)
200token.TrailingTrivia); 247token.TrailingTrivia);
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (4)
90count += previousToken.TrailingTrivia.Count(t => t.IsDocComment()); 297&& lastTextToken.TrailingTrivia.Count == 0 353&& lastTextToken.TrailingTrivia.Count == 0; 360=> token.TrailingTrivia.Any(t => t.Kind() == SyntaxKind.SkippedTokensTrivia);
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (1)
212foreach (var trivia in token.LeadingTrivia.Concat(token.TrailingTrivia))
ExtractMethod\Extensions.cs (2)
226foreach (var trivia in token.TrailingTrivia) 238if (token1.TrailingTrivia.Any(t => !t.IsElastic()))
Highlighting\KeywordHighlighters\IfStatementHighlighter.cs (1)
80return first.TrailingTrivia.AsString().All(c => c == ' ') &&
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (3)
226.AddRange(oldBody.ArrowToken.TrailingTrivia); 473if (!priorToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && 474!nextStatement.GetLastToken().TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia))
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (1)
214|| block.OpenBraceToken.TrailingTrivia.Any(HasCommentTrivia);
MetadataAsSource\FormattingRule.cs (1)
56var triviaList = token1.TrailingTrivia.Concat(token2.LeadingTrivia);
SplitStringLiteral\SimpleStringSplitter.cs (1)
62trailing: _token.TrailingTrivia);
src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
96if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)])
src\Analyzers\CSharp\Analyzers\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementDiagnosticAnalyzer.cs (1)
77if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)])
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (3)
79if (colonToken.TrailingTrivia.Count == 0) 82if (colonToken.TrailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) 85if (colonToken.TrailingTrivia.Any(t => !t.IsWhitespaceOrEndOfLine()))
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
122=> ContainsEndOfLine(previous.TrailingTrivia) || ContainsEndOfLine(next.LeadingTrivia);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
671.WithPrependedLeadingTrivia(originalInitializer.OpenBraceToken.GetPreviousToken().TrailingTrivia) 680if (initializer.OpenBraceToken.GetPreviousToken().TrailingTrivia.Any(static x => x.IsSingleOrMultiLineComment()))
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
235var trailingTrivia = semicolonToken.TrailingTrivia
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (4)
331if (!namespaceDeclaration.OpenBraceToken.TrailingTrivia.All(static t => t.IsWhitespace())) 332semiColon = semiColon.WithAppendedTrailingTrivia(namespaceDeclaration.OpenBraceToken.TrailingTrivia); 348.WithAppendedTrailingTrivia(namespaceDeclaration.CloseBraceToken.TrailingTrivia); 386var openBraceToken = OpenBraceToken.WithoutLeadingTrivia().WithTrailingTrivia(fileScopedNamespace.SemicolonToken.TrailingTrivia);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (2)
250Token(leading: default, SyntaxKind.SwitchKeyword, node.CloseParenToken.TrailingTrivia), 251Token(leading: default, SyntaxKind.OpenBraceToken, node.OpenBraceToken.TrailingTrivia),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
274typeDeclaration.Identifier.TrailingTrivia;
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (3)
77replacementMap[colonToken] = colonToken.WithLeadingTrivia(colonToken.LeadingTrivia.AddRange(colonToken.TrailingTrivia).AddRange(thisBaseKeyword.LeadingTrivia)) 104var allColonTrivia = colonToken.LeadingTrivia.AddRange(colonToken.TrailingTrivia); 106return previousToken.TrailingTrivia.All(t => t.Kind() == SyntaxKind.WhitespaceTrivia)
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (1)
66.WithTrailingTrivia(recordKeyword.TrailingTrivia);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
180initializer.OpenBraceToken.GetPreviousToken().TrailingTrivia.Any(static x => x.IsSingleOrMultiLineComment()); 184var additionalLeadingTrivia = initializer!.OpenBraceToken.GetPreviousToken().TrailingTrivia
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
50var trailingTrivia = statement.SemicolonToken.TrailingTrivia.Contains(static t => t.IsSingleOrMultiLineComment()) 51? statement.SemicolonToken.TrailingTrivia
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
46if (declaration.ArrowToken.TrailingTrivia.All(t => t.IsWhitespaceOrEndOfLine()) &&
src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
78=> newKeyword.TrailingTrivia.All(t => t.IsWhitespace())
src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
58InterpolatedVerbatimText, InterpolatedVerbatimText, oldStartToken.TrailingTrivia);
src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
52.WithStatement(newWhenTrueStatement.WithPrependedLeadingTrivia(ifStatement.CloseParenToken.TrailingTrivia));
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (4)
150var openBraceTrailingTrivia = blockSyntax.OpenBraceToken.TrailingTrivia; 151var usingHasEndOfLineTrivia = usingStatement.CloseParenToken.TrailingTrivia 174var closeBraceTrailingTrivia = blockSyntax.CloseBraceToken.TrailingTrivia; 205SemicolonToken).WithTrailingTrivia(usingStatement.CloseParenToken.TrailingTrivia);
Structure\CSharpStructureHelpers.cs (2)
31var lastTrailingCommentOrWhitespaceTrivia = firstToken.TrailingTrivia.GetLastCommentOrWhitespace(); 44var trailingTrivia = lastToken.TrailingTrivia;
Structure\Providers\DisabledTextTriviaStructureProvider.cs (1)
40parentTriviaList = trivia.Token.TrailingTrivia;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (53)
LexicalAndXml\LexicalTests.cs (6)
458Assert.Empty(token.TrailingTrivia); 485Assert.Single(token.TrailingTrivia); 486Assert.Equal(SyntaxKind.EndOfLineTrivia, token.TrailingTrivia[0].Kind()); 519Assert.Single(token.TrailingTrivia); 520Assert.Equal(SyntaxKind.EndOfLineTrivia, token.TrailingTrivia[0].Kind()); 3826t.TrailingTrivia.Any(SyntaxKind.ConflictMarkerTrivia)));
LexicalAndXml\SyntaxTokenParserTests.cs (11)
278Assert.Empty(result.Token.TrailingTrivia); 283Assert.Empty(result.Token.TrailingTrivia); 299Assert.Empty(result.Token.TrailingTrivia); 304Assert.Empty(intermediateResult.Token.TrailingTrivia); 309Assert.Empty(intermediateResult.Token.TrailingTrivia); 333Assert.Empty(result.Token.TrailingTrivia); 338Assert.Empty(intermediateResult.Token.TrailingTrivia); 343Assert.Empty(intermediateResult.Token.TrailingTrivia); 360Assert.Empty(result.Token.TrailingTrivia); 374AssertTrivia(result.Token.TrailingTrivia, 397AssertTrivia(result.Token.TrailingTrivia,
ParentChecker.cs (1)
38foreach (var trivia in token.TrailingTrivia)
Parsing\StatementParsingTests.cs (3)
1962Assert.Equal(1, fs.ForEachKeyword.TrailingTrivia.Count); 1963Assert.Equal(SyntaxKind.SkippedTokensTrivia, fs.ForEachKeyword.TrailingTrivia[0].Kind()); 1964Assert.Equal("for", fs.ForEachKeyword.TrailingTrivia[0].ToString());
Parsing\SyntaxExtensions.cs (2)
24return node.GetLastToken(includeSkipped: true).TrailingTrivia; 51return token.TrailingTrivia;
Syntax\SyntaxNodeTests.cs (30)
1390var tokenTrivia = token.TrailingTrivia[0]; 1952Assert.Equal(2, someNode.Identifier.TrailingTrivia.Count); 1953Assert.True(someNode.Identifier.TrailingTrivia[0].HasStructure); 1954Assert.True(someNode.Identifier.TrailingTrivia[1].HasStructure); 1957Assert.False(someNode.Identifier.TrailingTrivia[0].Equals(someNode.Identifier.TrailingTrivia[1])); 1959var tt0 = someNode.Identifier.TrailingTrivia[0]; 1960var tt1 = someNode.Identifier.TrailingTrivia[1]; 1989Assert.Equal(2, someNode.Identifier.TrailingTrivia.Count); 1990Assert.True(someNode.Identifier.TrailingTrivia[0].HasStructure); 1991Assert.True(someNode.Identifier.TrailingTrivia[1].HasStructure); 1994Assert.False(someNode.Identifier.TrailingTrivia[0].Equals(someNode.Identifier.TrailingTrivia[1])); 1996var tt0 = someNode.Identifier.TrailingTrivia[0]; 1997var tt1 = someNode.Identifier.TrailingTrivia[1]; 2087var triviaLocation = method.ReturnType.GetLastToken().TrailingTrivia[0].GetLocation(); 2090Assert.Equal(method.ReturnType.GetLastToken().TrailingTrivia[0].Span, triviaLocation.SourceSpan); 2395var trivia = expr.DescendantTokens().First(t => t.Text == "a").TrailingTrivia[0]; 2456var trivia = id.TrailingTrivia[0]; 3604Assert.NotEqual(emptyTokenList[0].TrailingTrivia[0], emptyTokenList[1].TrailingTrivia[0]); 3607Assert.NotEqual(emptyTokenList[0].TrailingTrivia, emptyTokenList[1].TrailingTrivia); 3614Assert.NotEqual(emptyToken.LeadingTrivia[0], emptyToken.TrailingTrivia[0]); 3617Assert.NotEqual(emptyToken.LeadingTrivia, emptyToken.TrailingTrivia); 3756Assert.Equal(1, idToken.TrailingTrivia.Count); 3757Assert.Equal(0, idToken.TrailingTrivia.Span.Length); // zero-width elastic trivia 3764Assert.Equal(0, idToken.TrailingTrivia.Count); 3772Assert.Equal(1, idToken.TrailingTrivia.Count); 3773Assert.Equal(2, idToken.TrailingTrivia.Span.Length);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
490foreach (var trivia in token.TrailingTrivia)
Microsoft.CodeAnalysis.CSharp.Workspaces (48)
Classification\Worker.cs (1)
153ClassifyTriviaList(token.TrailingTrivia);
Classification\Worker_DocumentationComments.cs (2)
136ClassifyXmlTrivia(token.TrailingTrivia); 149ClassifyXmlTrivia(token.TrailingTrivia);
Classification\Worker_Preprocesser.cs (1)
82foreach (var trivia in lastToken.TrailingTrivia)
CodeGeneration\CSharpSyntaxGenerator.cs (2)
1797if (!parameter.Identifier.TrailingTrivia.Any(t => t.IsSingleOrMultiLineComment())) 3043var newNode = node.WithTrailingTrivia(node.GetTrailingTrivia().AddRange(previousToken.TrailingTrivia));
Rename\CSharpRenameRewriterLanguageService.cs (7)
615? newToken.CopyAnnotationsTo(SyntaxFactory.VerbatimIdentifier(newToken.LeadingTrivia, currentNewIdentifier, valueText, newToken.TrailingTrivia)) 616: newToken.CopyAnnotationsTo(SyntaxFactory.Identifier(newToken.LeadingTrivia, SyntaxKind.IdentifierToken, currentNewIdentifier, valueText, newToken.TrailingTrivia)); 642newToken = createNewStringLiteral(newToken.LeadingTrivia, replacedString, replacedString, newToken.TrailingTrivia); 697SyntaxFactory.Token(newToken.LeadingTrivia, SyntaxKind.InterpolatedStringTextToken, text, value, newToken.TrailingTrivia)); 709var newIdentifierToken = SyntaxFactory.Identifier(newToken.LeadingTrivia, _replacementText, newToken.TrailingTrivia); 725var updatedToken = RenameInTrivia(oldToken, oldToken.TrailingTrivia); 728newToken = newToken.WithTrailingTrivia(updatedToken.TrailingTrivia);
Simplification\CSharpSimplificationService.cs (1)
134syntaxToken.TrailingTrivia))
Simplification\CSharpSimplificationService.Expander.cs (3)
602identifier = identifier.CopyAnnotationsTo(VerbatimIdentifier(identifier.LeadingTrivia, name, name, identifier.TrailingTrivia)); 1009return Token(oldToken.LeadingTrivia, SyntaxKind.LessThanToken, "{", "{", oldToken.TrailingTrivia); 1014return Token(oldToken.LeadingTrivia, SyntaxKind.GreaterThanToken, "}", "}", oldToken.TrailingTrivia);
Simplification\Reducers\CSharpEscapingReducer.cs (2)
140? originalToken.CopyAnnotationsTo(SyntaxFactory.VerbatimIdentifier(originalToken.LeadingTrivia, unescapedText, originalToken.ValueText, originalToken.TrailingTrivia)) 141: originalToken.CopyAnnotationsTo(SyntaxFactory.Identifier(originalToken.LeadingTrivia, SyntaxKind.IdentifierToken, unescapedText, originalToken.ValueText, originalToken.TrailingTrivia));
Simplification\Simplifiers\NameSimplifier.cs (1)
521identifierToken.TrailingTrivia));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArrowExpressionClauseSyntaxExtensions.cs (2)
43if (arrowExpression.ArrowToken.TrailingTrivia.Any(t => t.IsSingleOrMultiLineComment())) 44statement = statement.WithPrependedLeadingTrivia(arrowExpression.ArrowToken.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberAccessExpressionSyntaxExtensions.cs (1)
31.AddRange(memberAccess.OperatorToken.TrailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
85return prevToken.TrailingTrivia.Concat(token.LeadingTrivia); 524ContainsInterleavedDirective(textSpan, token.TrailingTrivia, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
42if (token.TrailingTrivia.Count > 0) 69token.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (3)
182foreach (var trivia in token.TrailingTrivia) 226token.TrailingTrivia.Concat(SyntaxNodeOrTokenExtensions.GetTrivia(trailingNodesOrTokens).Concat(trailingTrivia))).FilterComments(addElasticMarker: false)); 229=> token.WithTrailingTrivia(token.TrailingTrivia.FilterComments(addElasticMarker: true))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (3)
27Analyze(token.TrailingTrivia, ref result); 76if (previousToken.TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia)]) 84Analyze(token1.TrailingTrivia, ref result);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
185trailingTrivia = token.TrailingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
291ProcessTriviaList(list, child.AsToken().TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (3)
92var updatedToken = lastToken.ReplaceTrivia(lastToken.TrailingTrivia, 135return Literal(token.LeadingTrivia, tokenText, token.ValueText, token.TrailingTrivia); 144return Literal(token.LeadingTrivia, tokenText, token.ValueText, token.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CastExpressionSyntaxExtensions.cs (2)
18.Concat(node.OpenParenToken.TrailingTrivia) 22.Concat(node.CloseParenToken.TrailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2260(castExpression.Expression.IsMissing || castExpression.CloseParenToken.TrailingTrivia.GetFirstNewLine().HasValue))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (4)
103var trailingTrivia = appendNewLineIfMissing ? token.TrailingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.TrailingTrivia; 119typeDeclaration = typeDeclaration.WithSemicolonToken(default).WithTrailingTrivia(typeDeclaration.SemicolonToken.TrailingTrivia); 139openBrace.TrailingTrivia.Concat(closeBrace.LeadingTrivia.Take(index + 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
279.WithTrailingTrivia(propertyDeclaration.SemicolonToken.TrailingTrivia) 301return result.WithTrailingTrivia(accessorDeclaration.Body?.GetTrailingTrivia() ?? accessorDeclaration.SemicolonToken.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (1)
53syntaxToken.TrailingTrivia))
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (1)
124var skippedTrivia = namespaceDeclaration.OpenBraceToken.TrailingTrivia.Single(t => t.Kind() is SyntaxKind.SkippedTokensTrivia);
Microsoft.CodeAnalysis.Features (16)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (3)
171trivia = [.. endToken.TrailingTrivia]; 228var newStartToken = startToken.WithLeadingTrivia(previousOfStart.TrailingTrivia.Concat(startToken.LeadingTrivia)); 236newEndToken = newEndToken.WithTrailingTrivia(endToken.TrailingTrivia.Concat(nextOfEnd.LeadingTrivia));
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
108: token.TrailingTrivia;
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
214!previousToken.TrailingTrivia.Any(syntaxFacts.IsEndOfLineTrivia))
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
87if (HasLanguageComment(token.GetPreviousToken().TrailingTrivia, syntaxFacts, out identifier, out options))
ExtractMethod\AbstractSyntaxTriviaService.cs (1)
129foreach (var trivia in token1.TrailingTrivia.Concat(token2.LeadingTrivia))
ExtractMethod\AbstractSyntaxTriviaService.Result.cs (1)
278return tokenPair.PreviousToken.TrailingTrivia.Concat(trailingTrivia).Concat(leadingTrivia).Concat(tokenPair.NextToken.LeadingTrivia);
ExtractMethod\MethodExtractor.VariableSymbol.cs (2)
276if (ContainsNoisyTrivia(identifier.TrailingTrivia)) 294if (ContainsNoisyTrivia(token.TrailingTrivia))
SpellCheck\AbstractSpellCheckSpanService.cs (1)
111ProcessTriviaList(token.TrailingTrivia, cancellationToken);
src\Analyzers\Core\Analyzers\NewLines\ConsecutiveStatementPlacement\AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (2)
77if (!endToken.TrailingTrivia.Any()) 80if (!_syntaxFacts.IsEndOfLineTrivia(endToken.TrailingTrivia.Last()))
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (2)
114if (currentToken.TrailingTrivia is [.., var endOfLine, var whitespace2] && 119var trailingTrivia = currentToken.TrailingTrivia.Replace(
Structure\Syntax\BlockSpanCollector.cs (1)
79GetOutliningSpans(token.TrailingTrivia, spans);
Microsoft.CodeAnalysis.Test.Utilities (1)
Syntax\XmlHelpers.cs (1)
201if (token.TrailingTrivia.Any())
Microsoft.CodeAnalysis.UnitTests (4)
CommonSyntaxTests.cs (4)
113var csharpTriviaList = csharpToken.TrailingTrivia; 132var commonTriviaList2 = commonToken.TrailingTrivia; 150var vbTriviaList = (SyntaxTriviaList)vbToken.TrailingTrivia; 169var commonTriviaList2 = commonToken.TrailingTrivia;
Microsoft.CodeAnalysis.VisualBasic (19)
Syntax\SyntaxFactory.vb (3)
872token = token.WithTrailingTrivia(token.TrailingTrivia.Add(DocumentationCommentExteriorTrivia("''' "))) 924Return Token(rewrittenToken.LeadingTrivia, SyntaxKind.LessThanToken, rewrittenToken.TrailingTrivia, rewrittenToken.ValueText) 928Return Token(rewrittenToken.LeadingTrivia, SyntaxKind.GreaterThanToken, rewrittenToken.TrailingTrivia, rewrittenToken.ValueText)
Syntax\SyntaxNodeRemover.vb (6)
231Me.AddResidualTrivia(token.TrailingTrivia) 234(HasEndOfLine(token.LeadingTrivia) OrElse HasEndOfLine(token.TrailingTrivia) OrElse HasEndOfLine(node.GetLeadingTrivia())) Then 271Me.AddResidualTrivia(token.TrailingTrivia) 273(HasEndOfLine(node.GetTrailingTrivia()) OrElse HasEndOfLine(token.LeadingTrivia) OrElse HasEndOfLine(token.TrailingTrivia)) Then 346(parentToken.TrailingTrivia, parentToken.TrailingTrivia.IndexOf(trivia)))
Syntax\SyntaxNormalizer.vb (5)
155token.TrailingTrivia, 167If newToken.TrailingTrivia.Count = 0 AndAlso IsNewLineChar(newToken.ValueText.Last) Then 303Return (token.HasTrailingTrivia AndAlso token.TrailingTrivia.Last.Kind = SyntaxKind.ColonTrivia) OrElse 630trivia.GetStructure.GetLastToken.TrailingTrivia.Last.Kind = SyntaxKind.EndOfLineTrivia Then 709node.TrailingTrivia.Last.Kind = SyntaxKind.ColonTrivia
Syntax\VisualBasicSyntaxNode.vb (1)
178Return GetLastToken(includeZeroWidth:=True).TrailingTrivia
Syntax\VisualBasicSyntaxRewriter.vb (3)
47Dim trailing = Me.VisitList(token.TrailingTrivia) 48If leading <> token.LeadingTrivia OrElse trailing <> token.TrailingTrivia Then 52If trailing <> token.TrailingTrivia Then
Syntax\VisualBasicSyntaxWalker.vb (1)
72For Each tr In token.TrailingTrivia
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (17)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SingleLineRewriter.vb (3)
31If token.TrailingTrivia.Count > 0 Then 53token.TrailingTrivia) 58token.TrailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
384ContainsInterleavedDirective(textSpan, token.TrailingTrivia, cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (2)
22Dim trailing = token.TrailingTrivia 282For Each trivia In token.TrailingTrivia
src\Workspaces\VisualBasic\Portable\Formatting\DefaultOperationProvider.vb (2)
61Dim combinedTrivia = (previousToken.TrailingTrivia, currentToken.LeadingTrivia) 178Return previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) OrElse nextToken.LeadingTrivia.Any(SyntaxKind.EndOfLineTrivia)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (2)
18Analyze(token.TrailingTrivia, result) 29Analyze(token1.TrailingTrivia, result)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
63Dim list As TriviaList = New TriviaList(commonToken1.TrailingTrivia, commonToken2.LeadingTrivia)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
75Dim list = New TriviaList(commonToken1.TrailingTrivia, commonToken2.LeadingTrivia)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (1)
140Dim trailingTrivia = token.TrailingTrivia
src\Workspaces\VisualBasic\Portable\Formatting\Rules\AdjustSpaceFormattingRule.vb (2)
280Dim space = If(currentToken.TrailingTrivia.Any(SyntaxKind.LineContinuationTrivia), 1, 0) 363Return ContainsLineBreak(previousToken.LeadingTrivia) OrElse ContainsLineBreak(previousToken.GetPreviousToken(includeZeroWidth:=True).TrailingTrivia)
src\Workspaces\VisualBasic\Portable\Formatting\Rules\ElasticTriviaFormattingRule.vb (1)
341Dim list = token1.TrailingTrivia.Concat(token2.LeadingTrivia)
src\Workspaces\VisualBasic\Portable\Formatting\Rules\NodeBasedFormattingRule.vb (1)
307Return previousToken.TrailingTrivia.Any(Function(t) t.Kind = SyntaxKind.EndOfLineTrivia)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (7)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationHelpers.vb (1)
84If lastToken.TrailingTrivia.Any(Function(trivia) trivia.IsElastic()) Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (3)
14If token.TrailingTrivia.Any(Function(t) t.IsKind(SyntaxKind.ColonTrivia) AndAlso t.Span.End <= position) Then 66If CheckTrivia(token.TrailingTrivia, position, checkForSecondEol, allowsImplicitLineContinuation) Then 97If targetToken.IsKind(SyntaxKind.HashToken) AndAlso targetToken.TrailingTrivia.Any(Function(t)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\MemberAccessExpressionSyntaxExtensions.vb (1)
32AddRange(memberAccess.OperatorToken.TrailingTrivia).
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (1)
68endToken.TrailingTrivia.Any(SyntaxKind.LineContinuationTrivia) Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\VisualBasicSimplificationHelpers.vb (1)
29SyntaxFactory.BracketedIdentifier(identifierToken.LeadingTrivia, identifierToken.ValueText, identifierToken.TrailingTrivia) _
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (5)
AutomaticCompletion\AutomaticLineEnderCommandHandler.vb (1)
105If nonMissingToken.TrailingTrivia.Concat(nextToken.LeadingTrivia).Any(AddressOf HasSkippedText) Then
EndConstructGeneration\EndConstructStatementVisitor_IfStatement.vb (4)
31Dim trailingTrivia = If(node.ElseClause.ElseKeyword.HasTrailingTrivia AndAlso node.ElseClause.ElseKeyword.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia), 32node.ElseClause.ElseKeyword.TrailingTrivia, 90For Each trivia In lastToken.TrailingTrivia 110triviaLeftForNextStatement = lastToken.TrailingTrivia.SkipWhile(Function(t) t <> separator).Where(Function(t) t.Kind <> SyntaxKind.ColonTrivia)
Microsoft.CodeAnalysis.VisualBasic.Features (17)
BraceCompletion\BracketBraceCompletionService.vb (1)
52For Each trivia In token.TrailingTrivia
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (2)
201.WithTrailingTrivia(exitStatement.BlockKeyword.TrailingTrivia) 220.WithTrailingTrivia(continueStatement.BlockKeyword.TrailingTrivia)
CodeFixes\Suppression\VisualBasicSuppressionCodeFixProvider.vb (3)
87Return token.TrailingTrivia.Any(Function(t) t.Kind = SyntaxKind.LineContinuationTrivia) 248Dim enabledKeyword = SyntaxFactory.Token(disabledKeyword.LeadingTrivia, SyntaxKind.EnableKeyword, disabledKeyword.TrailingTrivia) 257Dim disabledKeyword = SyntaxFactory.Token(enabledKeyword.LeadingTrivia, SyntaxKind.DisableKeyword, enabledKeyword.TrailingTrivia)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
318Dim previousTokenTrailingTrivia = previousToken.TrailingTrivia.ToList()
ConvertForEachToFor\VisualBasicConvertForEachToForCodeRefactoringProvider.vb (1)
86.WithTrailingTrivia(controlVariable.GetLastToken().TrailingTrivia)), ExpressionSyntax)
DocumentationComments\VisualBasicDocumentationCommentSnippetService.vb (3)
106count += previousToken.TrailingTrivia.Sum(Function(t) If(t.Kind = SyntaxKind.DocumentationCommentTrivia, 1, 0)) 179lastTextToken.TrailingTrivia.Count = 0 255Return token.TrailingTrivia.Any(Function(t) t.Kind() = SyntaxKind.SkippedTokensTrivia)
ExtractMethod\VisualBasicMethodExtractor.PostProcessor.vb (1)
166For Each trivia In token.LeadingTrivia.Concat(token.TrailingTrivia)
ExtractMethod\VisualBasicMethodExtractor.TriviaResult.vb (4)
122token1.TrailingTrivia.Concat(list).Concat(ReplaceElasticToEndOfLine(token2.LeadingTrivia))) 126Return RemoveElasticAfterColon(token1.TrailingTrivia.Concat(list).Concat(token2.LeadingTrivia)) 129Return token1.TrailingTrivia.Concat(list) 140Return RemoveElasticAfterColon(token1.TrailingTrivia.Concat(list).Concat(token2.LeadingTrivia))
MetadataAsSource\VisualBasicMetadataAsSourceService.vb (1)
115Dim triviaList = token1.TrailingTrivia.Concat(token2.LeadingTrivia)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (47)
Parser\ParseDeclarationTests.vb (4)
1000Assert.Equal("(Of T)", DirectCast(c.Members(0), ConstructorBlockSyntax).SubNewStatement.NewKeyword.TrailingTrivia.Node.ToFullString) 1001Assert.Equal("(Of T)" + vbLf, DirectCast(c.Members(1), PropertyStatementSyntax).Identifier.TrailingTrivia.Node.ToFullString) 1002Assert.Equal("(Of T)" + vbLf, DirectCast(c.Members(2), EventStatementSyntax).Identifier.TrailingTrivia.Node.ToFullString) 1003Assert.Equal("(Of T)", DirectCast(c.Members(3), OperatorBlockSyntax).OperatorStatement.OperatorToken.TrailingTrivia.Node.ToFullString)
Parser\ParseExpression.vb (2)
1116Assert.Equal(lastToken.TrailingTrivia(0).Kind, SyntaxKind.ColonTrivia) 1140Assert.Equal(lastToken.TrailingTrivia(0).Kind, SyntaxKind.WhitespaceTrivia)
Scanner\ScannerTests.vb (3)
708Assert.Equal(SyntaxKind.CommentTrivia, tk.TrailingTrivia(0).Kind) 719Assert.Equal(SyntaxKind.CommentTrivia, tk.TrailingTrivia(0).Kind) 721Assert.Equal("' ", tk.TrailingTrivia(0).ToString())
Syntax\SyntaxFactsTest.vb (3)
1056For Each trivia In currentToken.TrailingTrivia 1137If currentToken.TrailingTrivia.Any(Function(t) 1155Dim newTrailing = Aggregate trivia In currentToken.TrailingTrivia
Syntax\SyntaxTokenFactoryTests.vb (19)
22Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 27Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 32Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 36Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 40Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 46Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 51Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 56Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 66Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 71Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 76Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 80Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 84Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 90Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 95Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 100Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 171Assert.Equal(1, id.TrailingTrivia.Count) 172Dim trivia = id.TrailingTrivia(0) 219Dim trivia = id.TrailingTrivia(0)
TestSyntaxNodes.vb (16)
356Dim precedingTrivia = tree.LeadingTrivia(), followingTrivia = tree.TrailingTrivia() 680Dim follTrivia = tok.TrailingTrivia() 696follTrivia = tok.TrailingTrivia() 727follTrivia = tok.TrailingTrivia() 774Assert.Equal(1, keyword.TrailingTrivia().Count) 775Assert.Equal(" ", keyword.TrailingTrivia()(0).ToString) 787Assert.Equal(0, keyword.TrailingTrivia().Count) 795Assert.Equal(1, keyword.TrailingTrivia().Count) 796Assert.Equal(" ", keyword.TrailingTrivia()(0).ToString) 806Assert.Equal(1, keyword.TrailingTrivia().Count) 807Assert.Equal(" ", keyword.TrailingTrivia()(0).ToString) 1131Return SyntaxFactory.IntegerLiteralToken(token.LeadingTrivia, value.ToString(), LiteralBase.Decimal, node.TypeSuffix, value, token.TrailingTrivia()) 1138node.TypeCharacter, token.TrailingTrivia()) 1145Return SyntaxFactory.Token(token.LeadingTrivia(), node.Kind, token.TrailingTrivia(), node.Text.ToUpperInvariant()) 1677Dim trivia = id.TrailingTrivia(0) 1736Assert.Equal(0, tree.GetRoot().FindToken(node.FullSpan.Length - 1).TrailingTrivia.Count)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
ParserTestUtilities.vb (2)
422For Each tr In node.AsToken.TrailingTrivia 828InternalVerifyNoAdjacentTriviaHaveSameKind(node, node.AsToken.TrailingTrivia)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (71)
CaseCorrection\VisualBasicCaseCorrectionService.Rewriter.vb (6)
157Return SyntaxFactory.Identifier(newToken.LeadingTrivia, "New", newToken.TrailingTrivia) 227Return SyntaxFactory.BracketedIdentifier(token.LeadingTrivia, correctedName, token.TrailingTrivia) 229Return SyntaxFactory.Identifier(token.LeadingTrivia, correctedName, token.TrailingTrivia) 258Return SyntaxFactory.Token(token.LeadingTrivia, token.Kind, token.TrailingTrivia, expectedText) 279Return SyntaxFactory.ParseToken(expectedText).WithLeadingTrivia(token.LeadingTrivia).WithTrailingTrivia(token.TrailingTrivia) 294Return SyntaxFactory.ParseToken(expectedText).WithLeadingTrivia(token.LeadingTrivia).WithTrailingTrivia(token.TrailingTrivia)
Classification\Worker.DocumentationCommentClassifier.vb (2)
111ClassifyXmlTrivia(token.TrailingTrivia, classificationType) 124ClassifyXmlTrivia(token.TrailingTrivia, whitespaceClassificationType:=ClassificationTypeNames.XmlDocCommentText)
Classification\Worker.vb (1)
106ClassifyTrivia(token.TrailingTrivia)
CodeCleanup\AsyncOrIteratorFunctionReturnTypeFixer.vb (1)
169Dim closeParenTrailingTrivia = closeParenToken.TrailingTrivia
CodeCleanup\Providers\AbstractTokensCodeCleanupProvider.vb (4)
82Dim trailing = If(token.TrailingTrivia.Count > 0, token.TrailingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker)) 93Dim trailing = If(token.TrailingTrivia.Count > 0, token.TrailingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker))
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (5)
226Dim prevTrailingTrivia = previousToken.TrailingTrivia 237Dim lastTrailingTrivia = lastToken.TrailingTrivia 365If lastToken.TrailingTrivia.Count = 0 Then 370.TrailingTrivia _ 559Return Not previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) And
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (2)
287Return SyntaxFactory.Token(newToken.LeadingTrivia, newToken.Kind, newToken.TrailingTrivia, expectedText) 300Dim skippedTokens = node.OperatorToken.TrailingTrivia _
CodeCleanup\Providers\ReduceTokensCodeCleanupProvider.vb (2)
297Dim trailing = If(token.TrailingTrivia.Count > 0, token.TrailingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker))
CodeCleanup\Providers\RemoveUnnecessaryLineContinuationCodeCleanupProvider.vb (1)
346Return GetTriviaList(token, _trailing, token.TrailingTrivia)
CodeGeneration\VisualBasicSyntaxGenerator.vb (12)
2249SyntaxFactory.Token(sb.EndBlockStatement.BlockKeyword.LeadingTrivia, SyntaxKind.FunctionKeyword, sb.EndBlockStatement.BlockKeyword.TrailingTrivia) 2257SyntaxFactory.Token(ss.DeclarationKeyword.LeadingTrivia, SyntaxKind.FunctionKeyword, ss.DeclarationKeyword.TrailingTrivia), 2270SyntaxFactory.Token(ds.DeclarationKeyword.LeadingTrivia, SyntaxKind.FunctionKeyword, ds.DeclarationKeyword.TrailingTrivia), 2284SyntaxFactory.Token(ml.EndSubOrFunctionStatement.BlockKeyword.LeadingTrivia, SyntaxKind.FunctionKeyword, ml.EndSubOrFunctionStatement.BlockKeyword.TrailingTrivia) 2298SyntaxFactory.Token(lh.DeclarationKeyword.LeadingTrivia, SyntaxKind.FunctionKeyword, lh.DeclarationKeyword.TrailingTrivia), 2308SyntaxFactory.Token(ds.DeclarationKeyword.LeadingTrivia, SyntaxKind.FunctionKeyword, ds.DeclarationKeyword.TrailingTrivia), 2334SyntaxFactory.Token(mb.EndBlockStatement.BlockKeyword.LeadingTrivia, SyntaxKind.SubKeyword, mb.EndBlockStatement.BlockKeyword.TrailingTrivia) 2342SyntaxFactory.Token(ms.DeclarationKeyword.LeadingTrivia, SyntaxKind.SubKeyword, ms.DeclarationKeyword.TrailingTrivia), 2355SyntaxFactory.Token(ds.DeclarationKeyword.LeadingTrivia, SyntaxKind.SubKeyword, ds.DeclarationKeyword.TrailingTrivia), 2369SyntaxFactory.Token(ml.EndSubOrFunctionStatement.BlockKeyword.LeadingTrivia, SyntaxKind.SubKeyword, ml.EndSubOrFunctionStatement.BlockKeyword.TrailingTrivia) 2383SyntaxFactory.Token(lh.DeclarationKeyword.LeadingTrivia, SyntaxKind.SubKeyword, lh.DeclarationKeyword.TrailingTrivia), 2393SyntaxFactory.Token(ds.DeclarationKeyword.LeadingTrivia, SyntaxKind.SubKeyword, ds.DeclarationKeyword.TrailingTrivia),
Formatting\DefaultOperationProvider.vb (2)
61Dim combinedTrivia = (previousToken.TrailingTrivia, currentToken.LeadingTrivia) 178Return previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) OrElse nextToken.LeadingTrivia.Any(SyntaxKind.EndOfLineTrivia)
Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (2)
18Analyze(token.TrailingTrivia, result) 29Analyze(token1.TrailingTrivia, result)
Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
63Dim list As TriviaList = New TriviaList(commonToken1.TrailingTrivia, commonToken2.LeadingTrivia)
Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
75Dim list = New TriviaList(commonToken1.TrailingTrivia, commonToken2.LeadingTrivia)
Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (1)
140Dim trailingTrivia = token.TrailingTrivia
Formatting\Rules\AdjustSpaceFormattingRule.vb (2)
280Dim space = If(currentToken.TrailingTrivia.Any(SyntaxKind.LineContinuationTrivia), 1, 0) 363Return ContainsLineBreak(previousToken.LeadingTrivia) OrElse ContainsLineBreak(previousToken.GetPreviousToken(includeZeroWidth:=True).TrailingTrivia)
Formatting\Rules\ElasticTriviaFormattingRule.vb (1)
341Dim list = token1.TrailingTrivia.Concat(token2.LeadingTrivia)
Formatting\Rules\NodeBasedFormattingRule.vb (1)
307Return previousToken.TrailingTrivia.Any(Function(t) t.Kind = SyntaxKind.EndOfLineTrivia)
Rename\VisualBasicRenameRewriterLanguageService.vb (6)
558newToken = newToken.CopyAnnotationsTo(SyntaxFactory.BracketedIdentifier(newToken.LeadingTrivia, valueText, newToken.TrailingTrivia)) 566newToken.TrailingTrivia)) 594newToken = createNewStringLiteral(newToken.LeadingTrivia, replacedString, replacedString, newToken.TrailingTrivia) 644Dim newIdentifierToken = SyntaxFactory.XmlNameToken(newToken.LeadingTrivia, _replacementText, SyntaxFacts.GetKeywordKind(_replacementText), newToken.TrailingTrivia) 657Dim updatedToken = RenameInTrivia(oldToken, oldToken.TrailingTrivia) 659newToken = newToken.WithTrailingTrivia(updatedToken.TrailingTrivia)
Simplification\Reducers\VisualBasicEscapingReducer.vb (2)
213originalToken.CopyAnnotationsTo(SyntaxFactory.BracketedIdentifier(originalToken.LeadingTrivia, originalToken.ValueText, originalToken.TrailingTrivia)), 214originalToken.CopyAnnotationsTo(SyntaxFactory.Identifier(originalToken.LeadingTrivia, originalToken.ValueText, originalToken.TrailingTrivia)))
Simplification\Simplifiers\NameSimplifier.vb (1)
386identifierToken.TrailingTrivia))
Simplification\VisualBasicSimplificationService.Expander.vb (2)
585identifier.CopyAnnotationsTo(SyntaxFactory.BracketedIdentifier(identifier.LeadingTrivia, newName, identifier.TrailingTrivia)), 586identifier.CopyAnnotationsTo(SyntaxFactory.Identifier(identifier.LeadingTrivia, newName, identifier.TrailingTrivia)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SingleLineRewriter.vb (3)
31If token.TrailingTrivia.Count > 0 Then 53token.TrailingTrivia) 58token.TrailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
384ContainsInterleavedDirective(textSpan, token.TrailingTrivia, cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (2)
22Dim trailing = token.TrailingTrivia 282For Each trivia In token.TrailingTrivia
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationHelpers.vb (1)
84If lastToken.TrailingTrivia.Any(Function(trivia) trivia.IsElastic()) Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (3)
14If token.TrailingTrivia.Any(Function(t) t.IsKind(SyntaxKind.ColonTrivia) AndAlso t.Span.End <= position) Then 66If CheckTrivia(token.TrailingTrivia, position, checkForSecondEol, allowsImplicitLineContinuation) Then 97If targetToken.IsKind(SyntaxKind.HashToken) AndAlso targetToken.TrailingTrivia.Any(Function(t)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\MemberAccessExpressionSyntaxExtensions.vb (1)
32AddRange(memberAccess.OperatorToken.TrailingTrivia).
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (1)
68endToken.TrailingTrivia.Any(SyntaxKind.LineContinuationTrivia) Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\VisualBasicSimplificationHelpers.vb (1)
29SyntaxFactory.BracketedIdentifier(identifierToken.LeadingTrivia, identifierToken.ValueText, identifierToken.TrailingTrivia) _
Microsoft.CodeAnalysis.Workspaces (29)
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (1)
166ClassifyStructuredTrivia(syntax.TrailingTrivia);
Editing\SyntaxGenerator.cs (3)
1073.WithTrailingTrivia(RemoveCommentLines(token.TrailingTrivia)); 1502.WithTrailingTrivia(replacement.TrailingTrivia.AddRange(original.TrailingTrivia));
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (1)
86ExtractStructureFromTrivia(stack, token.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (4)
633var skippedToken = findSkippedToken(token.TrailingTrivia, position); 676var skippedToken = findSkippedToken(token.TrailingTrivia, position); 953triviaList = triviaList.AddRange(token.TrailingTrivia); 966triviaList = triviaList.InsertRange(0, current.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (2)
102if (!token.LeadingTrivia.Any() && !token.TrailingTrivia.Any()) 158return token.WithTrailingTrivia(token.TrailingTrivia.Concat(trivia));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
190trivia = token.TrailingTrivia.Last();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.AbstractComplexTrivia.cs (1)
132var list = new TriviaList(Token1.TrailingTrivia, Token2.LeadingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (4)
254AddRange(triviaList, this.Token1.TrailingTrivia); 293var list = new TriviaList(this.Token1.TrailingTrivia, this.Token2.LeadingTrivia); 520if (this.Token1.TrailingTrivia.Count > 0 && 521this.Token1.TrailingTrivia[0].IsElastic())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
177if (token.TrailingTrivia.Count > 0 || HasTrailingWhitespace(tokenText))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
98!IsOnSingleLine(syntaxFacts, token.TrailingTrivia, trailing)) 234SpansPreprocessorDirective(syntaxFacts, previousToken.TrailingTrivia)) 339.Concat(openParenToken.TrailingTrivia) 346.Concat(closeParenToken.TrailingTrivia); 358if (previousToken.TrailingTrivia.Count == 0 &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (3)
198AppendPartialLeadingTriviaText(token2, builder, token1.TrailingTrivia.FullSpan.End); 249foreach (var trivia in token.TrailingTrivia) 355return previousToken.TrailingTrivia.HasAnyWhitespaceElasticTrivia() || currentToken.LeadingTrivia.HasAnyWhitespaceElasticTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (2)
531var trailing = isComma(nextToken) ? nextToken.TrailingTrivia : attributeToRemove.GetTrailingTrivia(); 564.WithTrailingTrivia(modifier.TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
180if (nextToken != default && !commaToken.TrailingTrivia.Any(t => t.RawKind == syntaxKinds.EndOfLineTrivia))
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
VisualStudioMSBuildWorkspaceTests.cs (1)
341var newDecl = decl.WithIdentifier(CS.SyntaxFactory.Identifier("Pogrom").WithLeadingTrivia(decl.Identifier.LeadingTrivia).WithTrailingTrivia(decl.Identifier.TrailingTrivia));
Microsoft.CodeAnalysis.Workspaces.UnitTests (5)
BatchFixAllProviderTests.cs (1)
127var newToken = SyntaxFactory.Literal(token.LeadingTrivia, replacement.ToString(), replacement, token.TrailingTrivia);
CodeCleanup\CodeCleanupTests.cs (2)
353root = root.ReplaceToken(previousToken, CSharp.SyntaxFactory.Identifier(previousToken.LeadingTrivia, previousToken.ValueText, previousToken.TrailingTrivia)); 354root = root.ReplaceToken(nextToken, CSharp.SyntaxFactory.Token(nextToken.LeadingTrivia, CSharp.CSharpExtensions.Kind(nextToken), nextToken.TrailingTrivia));
SyntaxNodeTests.cs (2)
61return Task.FromResult<SyntaxNode>(classDecl.WithIdentifier(SyntaxFactory.Identifier(id.LeadingTrivia, id.ToString() + "1", id.TrailingTrivia))); 67return Task.FromResult<SyntaxNode>(varDecl.WithIdentifier(SyntaxFactory.Identifier(id.LeadingTrivia, id.ToString() + "1", id.TrailingTrivia)));
Microsoft.VisualStudio.LanguageServices.CSharp (5)
CodeModel\CSharpCodeModelService.cs (5)
2307member = method.WithBody(null).WithSemicolonToken(SyntaxFactory.Token([SyntaxFactory.ElasticMarker], SyntaxKind.SemicolonToken, method.Body.CloseBraceToken.TrailingTrivia)); 2328var updatedAccessor = accessor.WithBody(null).WithSemicolonToken(SyntaxFactory.Token([SyntaxFactory.ElasticMarker], SyntaxKind.SemicolonToken, accessor.Body.CloseBraceToken.TrailingTrivia)); 2347newBody = newBody.WithCloseBraceToken(newBody.CloseBraceToken.WithTrailingTrivia(method.SemicolonToken.TrailingTrivia)); 2367newBody = newBody.WithCloseBraceToken(newBody.CloseBraceToken.WithTrailingTrivia(accessor.SemicolonToken.TrailingTrivia)); 3696identifier.WithTrailingTrivia(identifier.TrailingTrivia.SkipWhile(t => t.IsWhitespaceOrEndOfLine())));
Microsoft.VisualStudio.LanguageServices.VisualBasic (4)
CodeModel\VisualBasicCodeModelService.vb (4)
2423classKeyword:=SyntaxFactory.Token(moduleBlock.ModuleStatement.ModuleKeyword.LeadingTrivia, SyntaxKind.ClassKeyword, moduleBlock.ModuleStatement.ModuleKeyword.TrailingTrivia), 2431blockKeyword:=SyntaxFactory.Token(moduleBlock.EndModuleStatement.BlockKeyword.LeadingTrivia, SyntaxKind.ClassKeyword, moduleBlock.EndModuleStatement.BlockKeyword.TrailingTrivia))) 2443moduleKeyword:=SyntaxFactory.Token(classBlock.ClassStatement.ClassKeyword.LeadingTrivia, SyntaxKind.ModuleKeyword, classBlock.ClassStatement.ClassKeyword.TrailingTrivia), 2451blockKeyword:=SyntaxFactory.Token(classBlock.EndClassStatement.BlockKeyword.LeadingTrivia, SyntaxKind.ModuleKeyword, classBlock.EndClassStatement.BlockKeyword.TrailingTrivia)))