143 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 (48)
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)
162
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)
193
.WithTrailingTrivia(designation.
GetTrailingTrivia
());
204
.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)
150
? typeParameterList.
GetTrailingTrivia
()
359
.WithTrailingTrivia(baseType.
GetTrailingTrivia
()));
383
? typeParameterList.
GetTrailingTrivia
()
444
var newLeadingTrivia = assignmentExpression.Left.
GetTrailingTrivia
();
461
?? 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)
767
.WithTrailingTrivia(delegateDeclarationSyntax.ReturnType.
GetTrailingTrivia
());
775
.WithTrailingTrivia(methodDeclarationSyntax.ReturnType.
GetTrailingTrivia
());
783
.WithTrailingTrivia(operatorDeclarationSyntax.ReturnType.
GetTrailingTrivia
());
791
.WithTrailingTrivia(conversionOperatorDeclarationSyntax.Type.
GetTrailingTrivia
());
799
.WithTrailingTrivia(propertyDeclaration.Type.
GetTrailingTrivia
());
807
.WithTrailingTrivia(eventDeclarationSyntax.Type.
GetTrailingTrivia
());
815
.WithTrailingTrivia(indexerDeclarationSyntax.Type.
GetTrailingTrivia
());
827
.WithTrailingTrivia(parameterSyntax.Type.
GetTrailingTrivia
());
841
.WithTrailingTrivia(incompleteMemberSyntax.Type.
GetTrailingTrivia
());
851
.WithTrailingTrivia(arrayTypeSyntax.ElementType.
GetTrailingTrivia
());
859
.WithTrailingTrivia(pointerTypeSyntax.ElementType.
GetTrailingTrivia
());
867
.WithTrailingTrivia(variableDeclarationSyntax.Type.
GetTrailingTrivia
());
875
.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
());
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 (55)
ChangeSignature\CSharpChangeSignatureService.cs (1)
382
.WithTrailingTrivia(lambda.Parameter.
GetTrailingTrivia
());
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
330
.
GetTrailingTrivia
()
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)
362
triviaList.AddRange(variableDeclaration.
GetTrailingTrivia
());
448
newLeadingTrivia = newLeadingTrivia.AddRange(declaration.Type.
GetTrailingTrivia
());
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider_Update.cs (1)
235
.WithSemicolonToken(SemicolonToken.WithTrailingTrivia(newPropertyDeclaration.
GetTrailingTrivia
()))
InitializeParameter\InitializeParameterHelpers.cs (1)
195
return result.WithTrailingTrivia(accessorDeclaration.Body?.
GetTrailingTrivia
() ?? accessorDeclaration.SemicolonToken.TrailingTrivia);
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (1)
63
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)
34
.WithTrailingTrivia(expression.
GetTrailingTrivia
())
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
241
.WithTrailingTrivia(oldBody.
GetTrailingTrivia
());
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)
162
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)
193
.WithTrailingTrivia(designation.
GetTrailingTrivia
());
204
.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)
150
? typeParameterList.
GetTrailingTrivia
()
359
.WithTrailingTrivia(baseType.
GetTrailingTrivia
()));
383
? typeParameterList.
GetTrailingTrivia
()
444
var newLeadingTrivia = assignmentExpression.Left.
GetTrailingTrivia
();
461
?? 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 (33)
CodeGeneration\CSharpSyntaxGenerator.cs (3)
1808
method.ParameterList.
GetTrailingTrivia
().Add(SyntaxFactory.ElasticMarker).AddRange(method.ConstraintClauses.Last().
GetTrailingTrivia
())));
2259
.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)
767
.WithTrailingTrivia(delegateDeclarationSyntax.ReturnType.
GetTrailingTrivia
());
775
.WithTrailingTrivia(methodDeclarationSyntax.ReturnType.
GetTrailingTrivia
());
783
.WithTrailingTrivia(operatorDeclarationSyntax.ReturnType.
GetTrailingTrivia
());
791
.WithTrailingTrivia(conversionOperatorDeclarationSyntax.Type.
GetTrailingTrivia
());
799
.WithTrailingTrivia(propertyDeclaration.Type.
GetTrailingTrivia
());
807
.WithTrailingTrivia(eventDeclarationSyntax.Type.
GetTrailingTrivia
());
815
.WithTrailingTrivia(indexerDeclarationSyntax.Type.
GetTrailingTrivia
());
827
.WithTrailingTrivia(parameterSyntax.Type.
GetTrailingTrivia
());
841
.WithTrailingTrivia(incompleteMemberSyntax.Type.
GetTrailingTrivia
());
851
.WithTrailingTrivia(arrayTypeSyntax.ElementType.
GetTrailingTrivia
());
859
.WithTrailingTrivia(pointerTypeSyntax.ElementType.
GetTrailingTrivia
());
867
.WithTrailingTrivia(variableDeclarationSyntax.Type.
GetTrailingTrivia
());
875
.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
());
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\CSharpCodeModelService.cs (2)
2780
var trailingTrivia = node.
GetTrailingTrivia
();
3240
var trailingTrivia = lastMember.
GetTrailingTrivia
();