239 references to GetLeadingTrivia
Microsoft.Analyzers.Local (1)
InternalReferencedInPublicDocAnalyzer.cs (1)
42var symbolComment = symbolNode.GetLeadingTrivia()
Microsoft.AspNetCore.App.CodeFixes (3)
Authorization\AddAuthorizationBuilderFixer.cs (1)
119var invocationLeadingTrivia = invocation.GetLeadingTrivia()
Kestrel\ListenOnIPv6AnyFixer.cs (1)
69.WithLeadingTrivia(invocationExpressionSyntax.GetLeadingTrivia())
WebApplicationBuilderFixer.cs (1)
106var indentation = hostBasedInvocationMethodExpr.GetLeadingTrivia();
Microsoft.CodeAnalysis.CSharp (2)
Compiler\DocumentationCommentCompiler.cs (1)
272foreach (var trivia in implementationPart.GetNonNullSyntaxNode().GetLeadingTrivia())
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
64foreach (var trivia in syntaxNode.GetLeadingTrivia().Reverse())
Microsoft.CodeAnalysis.CSharp.CodeStyle (16)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (2)
117if (typeDeclaration.GetLeadingTrivia().Any(t => t.IsDocComment())) 146if (member.GetLeadingTrivia().Any(t => t.IsDocComment()))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
306.Concat(memberAccess.Name.GetLeadingTrivia())
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
160if (whenTrue.GetLeadingTrivia().Any(static t => t.GetStructure() is ConditionalDirectiveTriviaSyntax))
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (1)
63return !declaration.GetLeadingTrivia().Any(t => t.Kind() == SyntaxKind.EndOfLineTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (3)
53var leadingDirectives = statement.GetLeadingTrivia().Where(IsAnyCodeDirective).ToImmutableArray(); 195expression = firstStatement.GetLeadingTrivia().Any(t => t.IsDirective || t.IsSingleOrMultiLineComment()) 196? returnStatement.Expression.WithLeadingTrivia(returnStatement.GetLeadingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (3)
861if (expression.GetLeadingTrivia().Any(t => t.IsDirective)) 881if (expression.GetLeadingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 885.WithLeadingTrivia(expression.GetLeadingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberAccessExpressionSyntaxExtensions.cs (2)
28memberAccess.GetLeadingTrivia() 32.AddRange(memberAccess.Name.GetLeadingTrivia()))];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (1)
14=> statement.WithLeadingTrivia(statement.GetLeadingTrivia().WithoutLeadingBlankLines());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (2)
44if (!firstUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine())) 57!currentUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (52)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
100switchExpressionStatement = switchExpressionStatement.WithPrependedLeadingTrivia(declStatement.GetLeadingTrivia());
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (5)
578var classTrivia = typeDeclaration.GetLeadingTrivia().Where(trivia => !trivia.IsWhitespace()).AsImmutable(); 589var leadingPropTrivia = p.GetLeadingTrivia() 598? p.Type.GetLeadingTrivia() 703return docComment.GetLeadingTrivia(); 772var potentialDocComment = result.Declaration.GetLeadingTrivia().FirstOrNull(trivia => trivia.IsDocComment());
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
86.AddRange(elementNode.GetLeadingTrivia()));
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
97newStatement = newStatement.WithPrependedLeadingTrivia(ifStatement.GetLeadingTrivia());
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
200var newModifiers = TokenList(s_asyncKeywordWithSpace.WithLeadingTrivia(returnType.GetLeadingTrivia())); 208.WithAsyncKeyword(AsyncKeyword.WithPrependedLeadingTrivia(anonymous.GetLeadingTrivia()));
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (4)
72.WithAwaitKeyword(AwaitKeyword.WithLeadingTrivia(forEach.GetLeadingTrivia())); 77.WithAwaitKeyword(AwaitKeyword.WithLeadingTrivia(forEachDeconstruction.GetLeadingTrivia())); 82.WithAwaitKeyword(AwaitKeyword.WithLeadingTrivia(usingStatement.GetLeadingTrivia())); 87.WithAwaitKeyword(AwaitKeyword.WithLeadingTrivia(localDeclaration.GetLeadingTrivia()));
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (2)
286var leadingTrivia = usingDirective.GetLeadingTrivia(); 411var leadingTrivia = syntaxRoot.GetLeadingTrivia();
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
454DotDotToken.WithLeadingTrivia(expression.GetLeadingTrivia()).WithTrailingTrivia(Space), 664var leadingTrivia = parentStatement.GetLeadingTrivia();
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (1)
47var trivia = statement.GetLeadingTrivia();
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (3)
71if (newWhenTrueStatement.GetLeadingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 74.WithPrependedLeadingTrivia(ifStatement.GetLeadingTrivia()) 79newWhenTrueStatement = newWhenTrueStatement.WithLeadingTrivia(ifStatement.GetLeadingTrivia());
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
47expressionBody.GetLeadingTrivia().All(t => t.IsWhitespaceOrEndOfLine()))
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
96var leadingTrivia = declarationExpression.GetLeadingTrivia()
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
67var trivia = localDeclaration.GetLeadingTrivia().Concat(localDeclaration.GetTrailingTrivia())
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpUseNotPatternCodeFixProvider.cs (1)
65negated.WithPrependedLeadingTrivia(notExpression.GetLeadingTrivia())
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
204var leadingTrivia = firstMember.GetLeadingTrivia().ToImmutableArray(); 552=> memberDeclaration.GetLeadingTrivia().Any(t => t.GetStructure()?.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia)
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (2)
41=> GetDocCommentStructure(node.GetLeadingTrivia()); 103var typeDeclarationLeadingTrivia = typeDeclaration.GetLeadingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (13)
790.WithLeadingTrivia(delegateDeclarationSyntax.ReturnType.GetLeadingTrivia()) 798.WithLeadingTrivia(methodDeclarationSyntax.ReturnType.GetLeadingTrivia()) 806.WithLeadingTrivia(operatorDeclarationSyntax.ReturnType.GetLeadingTrivia()) 814.WithLeadingTrivia(conversionOperatorDeclarationSyntax.Type.GetLeadingTrivia()) 822.WithLeadingTrivia(propertyDeclaration.Type.GetLeadingTrivia()) 830.WithLeadingTrivia(eventDeclarationSyntax.Type.GetLeadingTrivia()) 838.WithLeadingTrivia(indexerDeclarationSyntax.Type.GetLeadingTrivia()) 850.WithLeadingTrivia(parameterSyntax.Type.GetLeadingTrivia()) 864.WithLeadingTrivia(incompleteMemberSyntax.Type.GetLeadingTrivia()) 874.WithLeadingTrivia(arrayTypeSyntax.ElementType.GetLeadingTrivia()) 882.WithLeadingTrivia(pointerTypeSyntax.ElementType.GetLeadingTrivia()) 890.WithLeadingTrivia(variableDeclarationSyntax.Type.GetLeadingTrivia()) 898.WithLeadingTrivia(catchDeclarationSyntax.Type.GetLeadingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CastExpressionSyntaxExtensions.cs (2)
19.Concat(node.Type.GetLeadingTrivia()) 23.Concat(node.Expression.GetLeadingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (2)
150if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 155if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.EndIfDirectiveTrivia)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (3)
61var leadingTrivia = currentUsing.GetLeadingTrivia(); 75if (ShouldPreserveTrivia(nextUsing.GetLeadingTrivia())) 115var currentUsingLeadingTrivia = currentUsing.GetLeadingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (2)
79leading: declarationExpression.GetLeadingTrivia(), 198var leadingTrivia = _localDeclarationStatement.Declaration.Type.GetLeadingTrivia()
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
76var leadingTrivia = node.GetLeadingTrivia();
Microsoft.CodeAnalysis.CSharp.Features (71)
ChangeSignature\CSharpChangeSignatureService.cs (1)
383.WithLeadingTrivia(lambda.Parameter.GetLeadingTrivia())
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (1)
137leadingTriviaForAttributeList = memberNode.GetLeadingTrivia();
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
133method = method.WithoutLeadingTrivia().WithAttributeLists(localFunction.AttributeLists).WithLeadingTrivia(method.GetLeadingTrivia());
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (2)
300var newLocalDeclaration = variableDeclarator.GetLeadingTrivia().Any(t => t.IsDirective) 323.GetLeadingTrivia()
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
458openingBuilder.AddRange(baseNamespace.GetLeadingTrivia());
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (1)
58var newLeadingTrivia = castExpression.GetLeadingTrivia().AddRange(middleTrivia);
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (1)
55var newLeadingTrivia = asExpression.GetLeadingTrivia().AddRange(asExpression.OperatorToken.TrailingTrivia.SkipInitialWhitespace());
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
185localDeclarationStatement.Declaration.Type.GetLeadingTrivia(),
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider_DocumentationComments.cs (2)
35var triviaList = typeDeclaration.GetLeadingTrivia(); 112var triviaList = typeDeclaration.GetLeadingTrivia();
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (3)
114var oldTriviaWithoutBlankLines = oldClassDeclaration.GetLeadingTrivia().WithoutLeadingBlankLines(); 136triviaToMove = statement.GetLeadingTrivia(); 140var commentsToPreserve = TriviaList(statement.GetLeadingTrivia().Skip(triviaToMove.Count));
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (4)
189statements.AddRange(methodDeclaration.Body.Statements[0].WithPrependedLeadingTrivia(methodDeclaration.GetLeadingTrivia())); 205expressionBody: otherMethod.ExpressionBody).WithLeadingTrivia(otherMethod.GetLeadingTrivia())); 217statements[0] = statements[0].WithPrependedLeadingTrivia(typeDeclaration.GetLeadingTrivia()); 226namespaceDeclaration.GetLeadingTrivia().TakeWhile(t => t.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia));
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
207newNode = newNode.WithLeadingTrivia(newNode.GetLeadingTrivia().Add(Whitespace(indentation)));
Copilot\CSharpCopilotCodeFixProvider.cs (1)
129.WithLeadingTrivia(memberDeclaration.HasLeadingTrivia ? memberDeclaration.GetLeadingTrivia() : method.GetLeadingTrivia())
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
78.WithLeadingTrivia(fieldSyntax.GetLeadingTrivia())
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
73triviaList.AddRange(variable.GetLeadingTrivia());
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (4)
367triviaList.AddRange(variableDeclaration.GetLeadingTrivia()); 455newLeadingTrivia = newLeadingTrivia.AddRange(declaration.Type.GetLeadingTrivia()); 457newLeadingTrivia = newLeadingTrivia.AddRange(designation.GetLeadingTrivia()); 506identifierLeadingTrivia = identifierLeadingTrivia.AddRange(typeSyntax.GetLeadingTrivia());
FullyQualify\CSharpFullyQualifyService.cs (1)
45var leadingTrivia = simpleName.GetLeadingTrivia();
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (3)
63UsingKeyword.WithLeadingTrivia(expressionStatement.GetLeadingTrivia()), 85UsingKeyword.WithLeadingTrivia(declarationStatement.GetLeadingTrivia()), 108.WithUsingKeyword(Token(declarationStatement.GetLeadingTrivia(), SyntaxKind.UsingKeyword, [Space]));
IntroduceVariable\CSharpIntroduceVariableService.Rewriter.cs (1)
34.WithLeadingTrivia(expression.GetLeadingTrivia())
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
225var leadingTrivia = oldBody.GetLeadingTrivia() 487var nextStatementLeading = nextStatement.GetLeadingTrivia();
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
231var leadingTrivia = propertyDeclaration.GetLeadingTrivia();
Snippets\CSharpIntMainSnippetProvider.cs (1)
44var triviaSpan = returnStatement.GetLeadingTrivia().Span;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (2)
117if (typeDeclaration.GetLeadingTrivia().Any(t => t.IsDocComment())) 146if (member.GetLeadingTrivia().Any(t => t.IsDocComment()))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
306.Concat(memberAccess.Name.GetLeadingTrivia())
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
160if (whenTrue.GetLeadingTrivia().Any(static t => t.GetStructure() is ConditionalDirectiveTriviaSyntax))
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (1)
63return !declaration.GetLeadingTrivia().Any(t => t.Kind() == SyntaxKind.EndOfLineTrivia)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
100switchExpressionStatement = switchExpressionStatement.WithPrependedLeadingTrivia(declStatement.GetLeadingTrivia());
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (5)
578var classTrivia = typeDeclaration.GetLeadingTrivia().Where(trivia => !trivia.IsWhitespace()).AsImmutable(); 589var leadingPropTrivia = p.GetLeadingTrivia() 598? p.Type.GetLeadingTrivia() 703return docComment.GetLeadingTrivia(); 772var potentialDocComment = result.Declaration.GetLeadingTrivia().FirstOrNull(trivia => trivia.IsDocComment());
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
86.AddRange(elementNode.GetLeadingTrivia()));
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
97newStatement = newStatement.WithPrependedLeadingTrivia(ifStatement.GetLeadingTrivia());
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
200var newModifiers = TokenList(s_asyncKeywordWithSpace.WithLeadingTrivia(returnType.GetLeadingTrivia())); 208.WithAsyncKeyword(AsyncKeyword.WithPrependedLeadingTrivia(anonymous.GetLeadingTrivia()));
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (4)
72.WithAwaitKeyword(AwaitKeyword.WithLeadingTrivia(forEach.GetLeadingTrivia())); 77.WithAwaitKeyword(AwaitKeyword.WithLeadingTrivia(forEachDeconstruction.GetLeadingTrivia())); 82.WithAwaitKeyword(AwaitKeyword.WithLeadingTrivia(usingStatement.GetLeadingTrivia())); 87.WithAwaitKeyword(AwaitKeyword.WithLeadingTrivia(localDeclaration.GetLeadingTrivia()));
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (2)
286var leadingTrivia = usingDirective.GetLeadingTrivia(); 411var leadingTrivia = syntaxRoot.GetLeadingTrivia();
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
454DotDotToken.WithLeadingTrivia(expression.GetLeadingTrivia()).WithTrailingTrivia(Space), 664var leadingTrivia = parentStatement.GetLeadingTrivia();
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (1)
47var trivia = statement.GetLeadingTrivia();
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (3)
71if (newWhenTrueStatement.GetLeadingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 74.WithPrependedLeadingTrivia(ifStatement.GetLeadingTrivia()) 79newWhenTrueStatement = newWhenTrueStatement.WithLeadingTrivia(ifStatement.GetLeadingTrivia());
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
47expressionBody.GetLeadingTrivia().All(t => t.IsWhitespaceOrEndOfLine()))
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
96var leadingTrivia = declarationExpression.GetLeadingTrivia()
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
67var trivia = localDeclaration.GetLeadingTrivia().Concat(localDeclaration.GetTrailingTrivia())
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpUseNotPatternCodeFixProvider.cs (1)
65negated.WithPrependedLeadingTrivia(notExpression.GetLeadingTrivia())
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
204var leadingTrivia = firstMember.GetLeadingTrivia().ToImmutableArray(); 552=> memberDeclaration.GetLeadingTrivia().Any(t => t.GetStructure()?.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia)
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (2)
41=> GetDocCommentStructure(node.GetLeadingTrivia()); 103var typeDeclarationLeadingTrivia = typeDeclaration.GetLeadingTrivia();
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
152var leadingTrivia = property.GetLeadingTrivia();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (31)
LexicalAndXml\XmlDocCommentTests.cs (16)
149var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 195var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 342var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 393var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 906var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 932var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1068var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1210var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1294var leading = classdecl.GetLeadingTrivia(); 1836var trivias = keyword.GetLeadingTrivia(); 1871var trivias = keyword.GetLeadingTrivia(); 1906var trivias = keyword.GetLeadingTrivia(); 1941var trivias = keyword.GetLeadingTrivia(); 1978var trivias = typeParameter.GetLeadingTrivia(); 2014var trivias = typeParameter.GetLeadingTrivia(); 2051var trivias = keyword.GetLeadingTrivia();
Syntax\StructuredTriviaTests.cs (2)
88var identTrivia = identExpr.GetLeadingTrivia()[0]; 192var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia();
Syntax\SyntaxDiffingTests.cs (2)
312var leadingTrivia = node.GetLeadingTrivia(); 377var leadingTrivia = node.GetLeadingTrivia();
Syntax\SyntaxNodeTests.cs (11)
932var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; 935var triviaAgain = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; 1485c = c.WithLeadingTrivia(c.GetLeadingTrivia().Concat(c.GetLeadingTrivia())); 1487var leadingTriviaWithDuplicate = c.GetLeadingTrivia(); 2415var leadingTrivia = ex.GetLeadingTrivia(); 2437var leadingTrivia = ex.GetLeadingTrivia(); 3533Assert.Equal(1, node.GetLeadingTrivia().Count); 3535Assert.Equal(" ", node.GetLeadingTrivia().First().ToString()); 3544Assert.Equal(1, node.GetLeadingTrivia().Count); 3546Assert.Equal(" ", node.GetLeadingTrivia().First().ToString());
Microsoft.CodeAnalysis.CSharp.Workspaces (54)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
2235.WithLeadingTrivia(lambda.GetLeadingTrivia())
Simplification\CSharpSimplificationService.Expander.cs (9)
267.WithLeadingTrivia(node.GetLeadingTrivia()); 336.WithLeadingTrivia(node.GetLeadingTrivia())) 404.WithLeadingTrivia(node.GetLeadingTrivia()) 411rewrittenname).WithLeadingTrivia(node.GetLeadingTrivia()) 700var identifiersLeadingTrivia = newNode.GetLeadingTrivia(); 754.WithLeadingTrivia(newNode.GetLeadingTrivia()) 920.WithLeadingTrivia(rewrittenNode.GetLeadingTrivia())); 945.WithLeadingTrivia(rewrittenNode.GetLeadingTrivia()) 951var leadingTrivia = rewrittenNode.GetLeadingTrivia();
Simplification\Reducers\CSharpExtensionMethodReducer.cs (1)
105newMemberAccess = newMemberAccess.WithLeadingTrivia(node.GetLeadingTrivia());
Simplification\Reducers\CSharpVarReducer.Rewriter.cs (1)
48.WithLeadingTrivia(typeSyntax.GetLeadingTrivia())
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
154memberAccess.GetLeadingTrivia(),
Simplification\Simplifiers\NameSimplifier.cs (7)
89.WithLeadingTrivia(genericName.GetLeadingTrivia()) 129name.GetLeadingTrivia(), 294.WithLeadingTrivia(name.GetLeadingTrivia()) 313.WithLeadingTrivia(name.GetLeadingTrivia()); 327replacementNode = ((QualifiedNameSyntax)name).Right.WithLeadingTrivia(name.GetLeadingTrivia()); 527.WithLeadingTrivia(name.GetLeadingTrivia()); 532.WithLeadingTrivia(name.GetLeadingTrivia());
Simplification\Simplifiers\QualifiedCrefSimplifier.cs (1)
94replacement = replacement.WithLeadingTrivia(crefSyntax.GetLeadingTrivia());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (3)
53var leadingDirectives = statement.GetLeadingTrivia().Where(IsAnyCodeDirective).ToImmutableArray(); 195expression = firstStatement.GetLeadingTrivia().Any(t => t.IsDirective || t.IsSingleOrMultiLineComment()) 196? returnStatement.Expression.WithLeadingTrivia(returnStatement.GetLeadingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (3)
861if (expression.GetLeadingTrivia().Any(t => t.IsDirective)) 881if (expression.GetLeadingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 885.WithLeadingTrivia(expression.GetLeadingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberAccessExpressionSyntaxExtensions.cs (2)
28memberAccess.GetLeadingTrivia() 32.AddRange(memberAccess.Name.GetLeadingTrivia()))];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (1)
14=> statement.WithLeadingTrivia(statement.GetLeadingTrivia().WithoutLeadingBlankLines());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (2)
44if (!firstUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine())) 57!currentUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (13)
790.WithLeadingTrivia(delegateDeclarationSyntax.ReturnType.GetLeadingTrivia()) 798.WithLeadingTrivia(methodDeclarationSyntax.ReturnType.GetLeadingTrivia()) 806.WithLeadingTrivia(operatorDeclarationSyntax.ReturnType.GetLeadingTrivia()) 814.WithLeadingTrivia(conversionOperatorDeclarationSyntax.Type.GetLeadingTrivia()) 822.WithLeadingTrivia(propertyDeclaration.Type.GetLeadingTrivia()) 830.WithLeadingTrivia(eventDeclarationSyntax.Type.GetLeadingTrivia()) 838.WithLeadingTrivia(indexerDeclarationSyntax.Type.GetLeadingTrivia()) 850.WithLeadingTrivia(parameterSyntax.Type.GetLeadingTrivia()) 864.WithLeadingTrivia(incompleteMemberSyntax.Type.GetLeadingTrivia()) 874.WithLeadingTrivia(arrayTypeSyntax.ElementType.GetLeadingTrivia()) 882.WithLeadingTrivia(pointerTypeSyntax.ElementType.GetLeadingTrivia()) 890.WithLeadingTrivia(variableDeclarationSyntax.Type.GetLeadingTrivia()) 898.WithLeadingTrivia(catchDeclarationSyntax.Type.GetLeadingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CastExpressionSyntaxExtensions.cs (2)
19.Concat(node.Type.GetLeadingTrivia()) 23.Concat(node.Expression.GetLeadingTrivia())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (2)
150if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 155if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.EndIfDirectiveTrivia)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (3)
61var leadingTrivia = currentUsing.GetLeadingTrivia(); 75if (ShouldPreserveTrivia(nextUsing.GetLeadingTrivia())) 115var currentUsingLeadingTrivia = currentUsing.GetLeadingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (2)
79leading: declarationExpression.GetLeadingTrivia(), 198var leadingTrivia = _localDeclarationStatement.Declaration.Type.GetLeadingTrivia()
Microsoft.Gen.Logging (1)
Parsing\Parser.cs (1)
457var triviaList = method.GetLeadingTrivia();
Microsoft.Interop.SourceGeneration (1)
GeneratedStatements.cs (1)
85newLeadingTrivia = newLeadingTrivia.AddRange(firstStatementInStage.GetLeadingTrivia());
Microsoft.VisualStudio.LanguageServices.CSharp (5)
CodeModel\CSharpCodeModelService.cs (3)
1294var leadingTriviaList = memberDeclaration.GetLeadingTrivia().ToList(); 1331.GetLeadingTrivia() 1427var leadingTriviaList = memberDeclaration.GetLeadingTrivia().ToList();
CodeModel\MethodXml\MethodXmlBuilder.cs (1)
28GenerateComments(statement.GetLeadingTrivia());
CodeModel\ModifierFlagsExtensions.cs (1)
108var leadingTrivia = member.GetLeadingTrivia();
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (1)
85SyntaxTriviaList leadingTrivia = propertyDeclarationSyntax.GetLeadingTrivia();