148 references to GetTrailingTrivia
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
304memberAccess.Expression.GetTrailingTrivia()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberAccessExpressionSyntaxExtensions.cs (2)
19.WithTrailingTrivia(memberAccess.GetTrailingTrivia()); 29.AddRange(memberAccess.Expression.GetTrailingTrivia())
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (50)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
328.WithTrailingTrivia(namespaceDeclaration.Name.GetTrailingTrivia()) 350var originalHadTrailingNewLine = namespaceDeclaration.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia)]; 355var trailingTrivia = fileScopedNamespace.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
273var constructorTrivia = typeDeclaration.TypeParameterList?.GetTrailingTrivia() ?? 310var baseTrailingTrivia = baseRecord.Type.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
47var trailingTrivia = type.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
146(s, g) => s.WithAppendedTrailingTrivia(localDeclarationStatement.GetTrailingTrivia())); 299if (declaratorOpt.GetTrailingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 301designation = designation.WithAppendedTrailingTrivia(MassageTrivia(declaratorOpt.GetTrailingTrivia()));
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
155var ifStatementTrivia = ifStatement.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
78return binaryExpression.Left.WithTrailingTrivia(binaryExpression.GetTrailingTrivia())
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
103var trailingTrivia = declarationPattern.Type.GetTrailingTrivia().AddRange(triviaToAppend);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
699if (parentStatement.GetTrailingTrivia().Any(static t => t.IsSingleOrMultiLineComment())) 701foreach (var trivia in parentStatement.GetTrailingTrivia())
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
84if (!newWhenTrueStatement.GetTrailingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 85newWhenTrueStatement = newWhenTrueStatement.WithTrailingTrivia(ifStatement.GetTrailingTrivia());
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (2)
202.WithTrailingTrivia(designation.GetTrailingTrivia()); 213.WithTrailingTrivia(parensDesignation.GetTrailingTrivia());
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
23.WithType(objectCreation.Type.WithTrailingTrivia(objectCreation.ArgumentList.GetTrailingTrivia()))
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
67var trivia = localDeclaration.GetLeadingTrivia().Concat(localDeclaration.GetTrailingTrivia())
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpUseNotPatternCodeFixProvider.cs (1)
66.WithAppendedTrailingTrivia(notExpression.GetTrailingTrivia()));
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (5)
157? typeParameterList.GetTrailingTrivia() 402.WithTrailingTrivia(baseType.GetTrailingTrivia())); 426? typeParameterList.GetTrailingTrivia() 487var newLeadingTrivia = assignmentExpression.Left.GetTrailingTrivia(); 504?? SemicolonToken.WithTrailingTrivia(propertyDeclaration.GetTrailingTrivia()));
src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (3)
64throwStatement.GetTrailingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 71(current, _) => current.WithLeadingTrivia(current.GetLeadingTrivia().Concat(throwStatement.GetTrailingTrivia()))); 77(current, _) => current.WithTrailingTrivia(throwStatement.GetTrailingTrivia()));
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
172var stringLiteral = CreateUtf8String(SyntaxTriviaList.Empty, stringValue, argumentList.Arguments.Last().GetTrailingTrivia(), isConvertedToReadOnlySpan);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (13)
791.WithTrailingTrivia(delegateDeclarationSyntax.ReturnType.GetTrailingTrivia()); 799.WithTrailingTrivia(methodDeclarationSyntax.ReturnType.GetTrailingTrivia()); 807.WithTrailingTrivia(operatorDeclarationSyntax.ReturnType.GetTrailingTrivia()); 815.WithTrailingTrivia(conversionOperatorDeclarationSyntax.Type.GetTrailingTrivia()); 823.WithTrailingTrivia(propertyDeclaration.Type.GetTrailingTrivia()); 831.WithTrailingTrivia(eventDeclarationSyntax.Type.GetTrailingTrivia()); 839.WithTrailingTrivia(indexerDeclarationSyntax.Type.GetTrailingTrivia()); 851.WithTrailingTrivia(parameterSyntax.Type.GetTrailingTrivia()); 865.WithTrailingTrivia(incompleteMemberSyntax.Type.GetTrailingTrivia()); 875.WithTrailingTrivia(arrayTypeSyntax.ElementType.GetTrailingTrivia()); 883.WithTrailingTrivia(pointerTypeSyntax.ElementType.GetTrailingTrivia()); 891.WithTrailingTrivia(variableDeclarationSyntax.Type.GetTrailingTrivia()); 899.WithTrailingTrivia(catchDeclarationSyntax.Type.GetTrailingTrivia());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CastExpressionSyntaxExtensions.cs (2)
20.Concat(node.Type.GetTrailingTrivia()) 26var trailingTrivia = node.GetTrailingTrivia().Where(t => !t.IsElastic());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
83trailing: declarationExpression.GetTrailingTrivia()); 109right: declarationPattern.Type.WithTrailingTrivia(declarationPattern.GetTrailingTrivia())); 199.Concat(_localDeclarationStatement.Declaration.Type.GetTrailingTrivia());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
71.WithSemicolonToken(SemicolonToken.WithTrailingTrivia(newPropertyDeclaration.GetTrailingTrivia())) 301return result.WithTrailingTrivia(accessorDeclaration.Body?.GetTrailingTrivia() ?? accessorDeclaration.SemicolonToken.TrailingTrivia);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (2)
440var newArgumentList = ArgumentList().WithTrailingTrivia(typeNode.GetTrailingTrivia()); 997var trivia = objectCreationNodeWithoutInitializer.GetTrailingTrivia().Where(trivia => trivia.IsSingleOrMultiLineComment());
Microsoft.CodeAnalysis.CSharp.Features (56)
ChangeSignature\CSharpChangeSignatureService.cs (1)
384.WithTrailingTrivia(lambda.Parameter.GetTrailingTrivia());
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
330.GetTrailingTrivia()
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (1)
71nameEquals.Name.GetTrailingTrivia() is [(kind: SyntaxKind.WhitespaceTrivia)]
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (2)
59var newTrailingTrivia = typeNode.GetTrailingTrivia().WithoutLeadingBlankLines().AddRange(expression.GetTrailingTrivia().WithoutLeadingBlankLines());
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (2)
54var newTrailingTrivia = asExpression.Left.GetTrailingTrivia().SkipInitialWhitespace().ToSyntaxTriviaList().AddRange(asExpression.GetTrailingTrivia());
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
186localDeclarationStatement.Declaration.Type.GetTrailingTrivia() }.Flatten();
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (1)
275.WithTrailingTrivia(propertyDeclaration.GetTrailingTrivia()));
Copilot\CSharpCopilotCodeFixProvider.cs (1)
130.WithTrailingTrivia(memberDeclaration.HasTrailingTrivia ? memberDeclaration.GetTrailingTrivia() : method.GetTrailingTrivia())
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
79.WithTrailingTrivia(fieldSyntax.GetTrailingTrivia()));
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
74triviaList.AddRange(variable.GetTrailingTrivia());
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
368triviaList.AddRange(variableDeclaration.GetTrailingTrivia()); 456newLeadingTrivia = newLeadingTrivia.AddRange(declaration.Type.GetTrailingTrivia());
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (2)
67CloseParenToken.WithTrailingTrivia(expressionStatement.GetTrailingTrivia()), 89CloseParenToken.WithTrailingTrivia(declarationStatement.GetTrailingTrivia()),
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
67semicolonToken = SemicolonToken.WithTrailingTrivia(expression.GetTrailingTrivia()); 83semicolonToken = SemicolonToken.WithTrailingTrivia(expression.GetTrailingTrivia());
IntroduceVariable\CSharpIntroduceVariableService.Rewriter.cs (1)
35.WithTrailingTrivia(expression.GetTrailingTrivia())
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
236.WithTrailingTrivia(oldBody.GetTrailingTrivia()); 507nextStatement.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia) endOfLine] ? endOfLine : ElasticCarriageReturnLineFeed);
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (2)
148(trueStatement.WithTrailingTrivia(falseStatementOpt.GetTrailingTrivia()), 149falseStatementOpt.WithTrailingTrivia(trueStatement.GetTrailingTrivia()));
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (1)
188.WithTrailingTrivia(accessorDeclaration.Body.GetTrailingTrivia())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
304memberAccess.Expression.GetTrailingTrivia()
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
328.WithTrailingTrivia(namespaceDeclaration.Name.GetTrailingTrivia()) 350var originalHadTrailingNewLine = namespaceDeclaration.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia)]; 355var trailingTrivia = fileScopedNamespace.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
273var constructorTrivia = typeDeclaration.TypeParameterList?.GetTrailingTrivia() ?? 310var baseTrailingTrivia = baseRecord.Type.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
47var trailingTrivia = type.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
146(s, g) => s.WithAppendedTrailingTrivia(localDeclarationStatement.GetTrailingTrivia())); 299if (declaratorOpt.GetTrailingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 301designation = designation.WithAppendedTrailingTrivia(MassageTrivia(declaratorOpt.GetTrailingTrivia()));
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
155var ifStatementTrivia = ifStatement.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
78return binaryExpression.Left.WithTrailingTrivia(binaryExpression.GetTrailingTrivia())
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
103var trailingTrivia = declarationPattern.Type.GetTrailingTrivia().AddRange(triviaToAppend);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
699if (parentStatement.GetTrailingTrivia().Any(static t => t.IsSingleOrMultiLineComment())) 701foreach (var trivia in parentStatement.GetTrailingTrivia())
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
84if (!newWhenTrueStatement.GetTrailingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 85newWhenTrueStatement = newWhenTrueStatement.WithTrailingTrivia(ifStatement.GetTrailingTrivia());
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (2)
202.WithTrailingTrivia(designation.GetTrailingTrivia()); 213.WithTrailingTrivia(parensDesignation.GetTrailingTrivia());
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
23.WithType(objectCreation.Type.WithTrailingTrivia(objectCreation.ArgumentList.GetTrailingTrivia()))
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
67var trivia = localDeclaration.GetLeadingTrivia().Concat(localDeclaration.GetTrailingTrivia())
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpUseNotPatternCodeFixProvider.cs (1)
66.WithAppendedTrailingTrivia(notExpression.GetTrailingTrivia()));
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (5)
157? typeParameterList.GetTrailingTrivia() 402.WithTrailingTrivia(baseType.GetTrailingTrivia())); 426? typeParameterList.GetTrailingTrivia() 487var newLeadingTrivia = assignmentExpression.Left.GetTrailingTrivia(); 504?? SemicolonToken.WithTrailingTrivia(propertyDeclaration.GetTrailingTrivia()));
src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (3)
64throwStatement.GetTrailingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 71(current, _) => current.WithLeadingTrivia(current.GetLeadingTrivia().Concat(throwStatement.GetTrailingTrivia()))); 77(current, _) => current.WithTrailingTrivia(throwStatement.GetTrailingTrivia()));
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
172var stringLiteral = CreateUtf8String(SyntaxTriviaList.Empty, stringValue, argumentList.Arguments.Last().GetTrailingTrivia(), isConvertedToReadOnlySpan);
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
140.WithTrailingTrivia(propertyDeclaration.GetTrailingTrivia())
Microsoft.CodeAnalysis.CSharp.Workspaces (35)
CodeGeneration\CSharpSyntaxGenerator.cs (3)
1785method.ParameterList.GetTrailingTrivia().Add(SyntaxFactory.ElasticMarker).AddRange(method.ConstraintClauses.Last().GetTrailingTrivia()))); 2236.WithTrailingTrivia(lambda.GetTrailingTrivia());
Simplification\CSharpSimplificationService.Expander.cs (4)
405.WithTrailingTrivia(node.GetTrailingTrivia())) 412.WithTrailingTrivia(node.GetTrailingTrivia())) 755.WithTrailingTrivia(newNode.GetTrailingTrivia()) 946.WithTrailingTrivia(rewrittenNode.GetTrailingTrivia());
Simplification\Reducers\CSharpMiscellaneousReducer.cs (1)
100newParameterSyntax.WithTrailingTrivia(parenthesizedLambda.ParameterList.GetTrailingTrivia()),
Simplification\Reducers\CSharpVarReducer.Rewriter.cs (1)
49.WithTrailingTrivia(typeSyntax.GetTrailingTrivia());
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
158memberAccess.GetTrailingTrivia())));
Simplification\Simplifiers\NameSimplifier.cs (3)
90.WithTrailingTrivia(genericName.GetTrailingTrivia()); 133name.GetTrailingTrivia()); 295.WithTrailingTrivia(name.GetTrailingTrivia());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberAccessExpressionSyntaxExtensions.cs (2)
19.WithTrailingTrivia(memberAccess.GetTrailingTrivia()); 29.AddRange(memberAccess.Expression.GetTrailingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (13)
791.WithTrailingTrivia(delegateDeclarationSyntax.ReturnType.GetTrailingTrivia()); 799.WithTrailingTrivia(methodDeclarationSyntax.ReturnType.GetTrailingTrivia()); 807.WithTrailingTrivia(operatorDeclarationSyntax.ReturnType.GetTrailingTrivia()); 815.WithTrailingTrivia(conversionOperatorDeclarationSyntax.Type.GetTrailingTrivia()); 823.WithTrailingTrivia(propertyDeclaration.Type.GetTrailingTrivia()); 831.WithTrailingTrivia(eventDeclarationSyntax.Type.GetTrailingTrivia()); 839.WithTrailingTrivia(indexerDeclarationSyntax.Type.GetTrailingTrivia()); 851.WithTrailingTrivia(parameterSyntax.Type.GetTrailingTrivia()); 865.WithTrailingTrivia(incompleteMemberSyntax.Type.GetTrailingTrivia()); 875.WithTrailingTrivia(arrayTypeSyntax.ElementType.GetTrailingTrivia()); 883.WithTrailingTrivia(pointerTypeSyntax.ElementType.GetTrailingTrivia()); 891.WithTrailingTrivia(variableDeclarationSyntax.Type.GetTrailingTrivia()); 899.WithTrailingTrivia(catchDeclarationSyntax.Type.GetTrailingTrivia());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CastExpressionSyntaxExtensions.cs (2)
20.Concat(node.Type.GetTrailingTrivia()) 26var trailingTrivia = node.GetTrailingTrivia().Where(t => !t.IsElastic());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
83trailing: declarationExpression.GetTrailingTrivia()); 109right: declarationPattern.Type.WithTrailingTrivia(declarationPattern.GetTrailingTrivia())); 199.Concat(_localDeclarationStatement.Declaration.Type.GetTrailingTrivia());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
71.WithSemicolonToken(SemicolonToken.WithTrailingTrivia(newPropertyDeclaration.GetTrailingTrivia())) 301return result.WithTrailingTrivia(accessorDeclaration.Body?.GetTrailingTrivia() ?? accessorDeclaration.SemicolonToken.TrailingTrivia);
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\CSharpCodeModelService.cs (2)
2780var trailingTrivia = node.GetTrailingTrivia(); 3240var trailingTrivia = lastMember.GetTrailingTrivia();