148 references to GetTrailingTrivia
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
304
memberAccess.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
())
350
var originalHadTrailingNewLine = namespaceDeclaration.
GetTrailingTrivia
() is [.., (kind: SyntaxKind.EndOfLineTrivia)];
355
var trailingTrivia = fileScopedNamespace.
GetTrailingTrivia
();
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
273
var constructorTrivia = typeDeclaration.TypeParameterList?.
GetTrailingTrivia
() ??
310
var baseTrailingTrivia = baseRecord.Type.
GetTrailingTrivia
();
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
47
var trailingTrivia = type.
GetTrailingTrivia
();
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
146
(s, g) => s.WithAppendedTrailingTrivia(localDeclarationStatement.
GetTrailingTrivia
()));
299
if (declaratorOpt.
GetTrailingTrivia
().Any(t => t.IsSingleOrMultiLineComment()))
301
designation = designation.WithAppendedTrailingTrivia(MassageTrivia(declaratorOpt.
GetTrailingTrivia
()));
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
155
var ifStatementTrivia = ifStatement.
GetTrailingTrivia
();
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
78
return binaryExpression.Left.WithTrailingTrivia(binaryExpression.
GetTrailingTrivia
())
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
103
var trailingTrivia = declarationPattern.Type.
GetTrailingTrivia
().AddRange(triviaToAppend);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
699
if (parentStatement.
GetTrailingTrivia
().Any(static t => t.IsSingleOrMultiLineComment()))
701
foreach (var trivia in parentStatement.
GetTrailingTrivia
())
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
84
if (!newWhenTrueStatement.
GetTrailingTrivia
().Any(t => t.IsSingleOrMultiLineComment()))
85
newWhenTrueStatement = 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)
67
var 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
()
487
var newLeadingTrivia = assignmentExpression.Left.
GetTrailingTrivia
();
504
?? SemicolonToken.WithTrailingTrivia(propertyDeclaration.
GetTrailingTrivia
()));
src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (3)
64
throwStatement.
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)
172
var 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
())
26
var trailingTrivia = node.
GetTrailingTrivia
().Where(t => !t.IsElastic());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
83
trailing: declarationExpression.
GetTrailingTrivia
());
109
right: 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
()))
301
return result.WithTrailingTrivia(accessorDeclaration.Body?.
GetTrailingTrivia
() ?? accessorDeclaration.SemicolonToken.TrailingTrivia);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (2)
440
var newArgumentList = ArgumentList().WithTrailingTrivia(typeNode.
GetTrailingTrivia
());
997
var 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)
71
nameEquals.Name.
GetTrailingTrivia
() is [(kind: SyntaxKind.WhitespaceTrivia)]
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (2)
59
var newTrailingTrivia = typeNode.
GetTrailingTrivia
().WithoutLeadingBlankLines().AddRange(expression.
GetTrailingTrivia
().WithoutLeadingBlankLines());
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (2)
54
var newTrailingTrivia = asExpression.Left.
GetTrailingTrivia
().SkipInitialWhitespace().ToSyntaxTriviaList().AddRange(asExpression.
GetTrailingTrivia
());
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
186
localDeclarationStatement.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)
74
triviaList.AddRange(variable.
GetTrailingTrivia
());
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
368
triviaList.AddRange(variableDeclaration.
GetTrailingTrivia
());
456
newLeadingTrivia = newLeadingTrivia.AddRange(declaration.Type.
GetTrailingTrivia
());
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (2)
67
CloseParenToken.WithTrailingTrivia(expressionStatement.
GetTrailingTrivia
()),
89
CloseParenToken.WithTrailingTrivia(declarationStatement.
GetTrailingTrivia
()),
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
67
semicolonToken = SemicolonToken.WithTrailingTrivia(expression.
GetTrailingTrivia
());
83
semicolonToken = SemicolonToken.WithTrailingTrivia(expression.
GetTrailingTrivia
());
IntroduceVariable\CSharpIntroduceVariableService.Rewriter.cs (1)
35
.WithTrailingTrivia(expression.
GetTrailingTrivia
())
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
236
.WithTrailingTrivia(oldBody.
GetTrailingTrivia
());
507
nextStatement.
GetTrailingTrivia
() is [.., (kind: SyntaxKind.EndOfLineTrivia) endOfLine] ? endOfLine : ElasticCarriageReturnLineFeed);
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (2)
148
(trueStatement.WithTrailingTrivia(falseStatementOpt.
GetTrailingTrivia
()),
149
falseStatementOpt.WithTrailingTrivia(trueStatement.
GetTrailingTrivia
()));
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (1)
188
.WithTrailingTrivia(accessorDeclaration.Body.
GetTrailingTrivia
())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
304
memberAccess.Expression.
GetTrailingTrivia
()
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
328
.WithTrailingTrivia(namespaceDeclaration.Name.
GetTrailingTrivia
())
350
var originalHadTrailingNewLine = namespaceDeclaration.
GetTrailingTrivia
() is [.., (kind: SyntaxKind.EndOfLineTrivia)];
355
var trailingTrivia = fileScopedNamespace.
GetTrailingTrivia
();
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
273
var constructorTrivia = typeDeclaration.TypeParameterList?.
GetTrailingTrivia
() ??
310
var baseTrailingTrivia = baseRecord.Type.
GetTrailingTrivia
();
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
47
var trailingTrivia = type.
GetTrailingTrivia
();
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
146
(s, g) => s.WithAppendedTrailingTrivia(localDeclarationStatement.
GetTrailingTrivia
()));
299
if (declaratorOpt.
GetTrailingTrivia
().Any(t => t.IsSingleOrMultiLineComment()))
301
designation = designation.WithAppendedTrailingTrivia(MassageTrivia(declaratorOpt.
GetTrailingTrivia
()));
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
155
var ifStatementTrivia = ifStatement.
GetTrailingTrivia
();
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
78
return binaryExpression.Left.WithTrailingTrivia(binaryExpression.
GetTrailingTrivia
())
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
103
var trailingTrivia = declarationPattern.Type.
GetTrailingTrivia
().AddRange(triviaToAppend);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
699
if (parentStatement.
GetTrailingTrivia
().Any(static t => t.IsSingleOrMultiLineComment()))
701
foreach (var trivia in parentStatement.
GetTrailingTrivia
())
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
84
if (!newWhenTrueStatement.
GetTrailingTrivia
().Any(t => t.IsSingleOrMultiLineComment()))
85
newWhenTrueStatement = 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)
67
var 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
()
487
var newLeadingTrivia = assignmentExpression.Left.
GetTrailingTrivia
();
504
?? SemicolonToken.WithTrailingTrivia(propertyDeclaration.
GetTrailingTrivia
()));
src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (3)
64
throwStatement.
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)
172
var 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)
1785
method.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)
100
newParameterSyntax.WithTrailingTrivia(parenthesizedLambda.ParameterList.
GetTrailingTrivia
()),
Simplification\Reducers\CSharpVarReducer.Rewriter.cs (1)
49
.WithTrailingTrivia(typeSyntax.
GetTrailingTrivia
());
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
158
memberAccess.
GetTrailingTrivia
())));
Simplification\Simplifiers\NameSimplifier.cs (3)
90
.WithTrailingTrivia(genericName.
GetTrailingTrivia
());
133
name.
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
())
26
var trailingTrivia = node.
GetTrailingTrivia
().Where(t => !t.IsElastic());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
83
trailing: declarationExpression.
GetTrailingTrivia
());
109
right: 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
()))
301
return result.WithTrailingTrivia(accessorDeclaration.Body?.
GetTrailingTrivia
() ?? accessorDeclaration.SemicolonToken.TrailingTrivia);
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\CSharpCodeModelService.cs (2)
2780
var trailingTrivia = node.
GetTrailingTrivia
();
3240
var trailingTrivia = lastMember.
GetTrailingTrivia
();