234 references to GetLeadingTrivia
Microsoft.Analyzers.Local (1)
InternalReferencedInPublicDocAnalyzer.cs (1)
42var symbolComment = symbolNode.GetLeadingTrivia()
Microsoft.AspNetCore.App.CodeFixes (2)
Authorization\AddAuthorizationBuilderFixer.cs (1)
119var invocationLeadingTrivia = invocation.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 (15)
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)
317.Concat(memberAccess.Name.GetLeadingTrivia())
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
160if (whenTrue.GetLeadingTrivia().Any(static t => t.GetStructure() is ConditionalDirectiveTriviaSyntax))
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)
860if (expression.GetLeadingTrivia().Any(t => t.IsDirective)) 880if (expression.GetLeadingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 884.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)
35if (!firstUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine())) 48!currentUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (51)
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)
100newStatement = newStatement.WithPrependedLeadingTrivia(ifStatement.GetLeadingTrivia());
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
183var newModifiers = TokenList(s_asyncKeywordWithSpace.WithLeadingTrivia(returnType.GetLeadingTrivia())); 191.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)
95var 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 (1)
509=> 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)
766.WithLeadingTrivia(delegateDeclarationSyntax.ReturnType.GetLeadingTrivia()) 774.WithLeadingTrivia(methodDeclarationSyntax.ReturnType.GetLeadingTrivia()) 782.WithLeadingTrivia(operatorDeclarationSyntax.ReturnType.GetLeadingTrivia()) 790.WithLeadingTrivia(conversionOperatorDeclarationSyntax.Type.GetLeadingTrivia()) 798.WithLeadingTrivia(propertyDeclaration.Type.GetLeadingTrivia()) 806.WithLeadingTrivia(eventDeclarationSyntax.Type.GetLeadingTrivia()) 814.WithLeadingTrivia(indexerDeclarationSyntax.Type.GetLeadingTrivia()) 826.WithLeadingTrivia(parameterSyntax.Type.GetLeadingTrivia()) 840.WithLeadingTrivia(incompleteMemberSyntax.Type.GetLeadingTrivia()) 850.WithLeadingTrivia(arrayTypeSyntax.ElementType.GetLeadingTrivia()) 858.WithLeadingTrivia(pointerTypeSyntax.ElementType.GetLeadingTrivia()) 866.WithLeadingTrivia(variableDeclarationSyntax.Type.GetLeadingTrivia()) 874.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)
163if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 168if (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)
73leading: declarationExpression.GetLeadingTrivia(), 192var leadingTrivia = _localDeclarationStatement.Declaration.Type.GetLeadingTrivia()
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
76var leadingTrivia = node.GetLeadingTrivia();
Microsoft.CodeAnalysis.CSharp.Features (69)
ChangeSignature\CSharpChangeSignatureService.cs (1)
381.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)
304var newLocalDeclaration = variableDeclarator.GetLeadingTrivia().Any(t => t.IsDirective) 327.GetLeadingTrivia()
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
458openingBuilder.AddRange(baseNamespace.GetLeadingTrivia());
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (1)
35.WithPrependedLeadingTrivia(anonCreation.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)
201newNode = 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)
361triviaList.AddRange(variableDeclaration.GetLeadingTrivia()); 447newLeadingTrivia = newLeadingTrivia.AddRange(declaration.Type.GetLeadingTrivia()); 449newLeadingTrivia = newLeadingTrivia.AddRange(designation.GetLeadingTrivia()); 498identifierLeadingTrivia = identifierLeadingTrivia.AddRange(typeSyntax.GetLeadingTrivia());
FullyQualify\CSharpFullyQualifyService.cs (1)
45var leadingTrivia = simpleName.GetLeadingTrivia();
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (2)
59UsingKeyword.WithLeadingTrivia(declarationStatement.GetLeadingTrivia()), 82.WithUsingKeyword(Token(declarationStatement.GetLeadingTrivia(), SyntaxKind.UsingKeyword, [Space]));
IntroduceVariable\CSharpIntroduceVariableService.Rewriter.cs (1)
33.WithLeadingTrivia(expression.GetLeadingTrivia())
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
230var leadingTrivia = oldBody.GetLeadingTrivia() 427var nextStatementLeading = nextStatement.GetLeadingTrivia();
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
233var 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)
317.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\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)
100newStatement = newStatement.WithPrependedLeadingTrivia(ifStatement.GetLeadingTrivia());
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
183var newModifiers = TokenList(s_asyncKeywordWithSpace.WithLeadingTrivia(returnType.GetLeadingTrivia())); 191.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)
95var 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 (1)
509=> 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)
909var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; 912var triviaAgain = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; 1462c = c.WithLeadingTrivia(c.GetLeadingTrivia().Concat(c.GetLeadingTrivia())); 1464var leadingTriviaWithDuplicate = c.GetLeadingTrivia(); 2392var leadingTrivia = ex.GetLeadingTrivia(); 2414var leadingTrivia = ex.GetLeadingTrivia(); 3472Assert.Equal(1, node.GetLeadingTrivia().Count); 3474Assert.Equal(" ", node.GetLeadingTrivia().First().ToString()); 3483Assert.Equal(1, node.GetLeadingTrivia().Count); 3485Assert.Equal(" ", node.GetLeadingTrivia().First().ToString());
Microsoft.CodeAnalysis.CSharp.Workspaces (54)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
2258.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)
860if (expression.GetLeadingTrivia().Any(t => t.IsDirective)) 880if (expression.GetLeadingTrivia().Any(t => t.IsSingleOrMultiLineComment())) 884.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)
35if (!firstUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine())) 48!currentUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (13)
766.WithLeadingTrivia(delegateDeclarationSyntax.ReturnType.GetLeadingTrivia()) 774.WithLeadingTrivia(methodDeclarationSyntax.ReturnType.GetLeadingTrivia()) 782.WithLeadingTrivia(operatorDeclarationSyntax.ReturnType.GetLeadingTrivia()) 790.WithLeadingTrivia(conversionOperatorDeclarationSyntax.Type.GetLeadingTrivia()) 798.WithLeadingTrivia(propertyDeclaration.Type.GetLeadingTrivia()) 806.WithLeadingTrivia(eventDeclarationSyntax.Type.GetLeadingTrivia()) 814.WithLeadingTrivia(indexerDeclarationSyntax.Type.GetLeadingTrivia()) 826.WithLeadingTrivia(parameterSyntax.Type.GetLeadingTrivia()) 840.WithLeadingTrivia(incompleteMemberSyntax.Type.GetLeadingTrivia()) 850.WithLeadingTrivia(arrayTypeSyntax.ElementType.GetLeadingTrivia()) 858.WithLeadingTrivia(pointerTypeSyntax.ElementType.GetLeadingTrivia()) 866.WithLeadingTrivia(variableDeclarationSyntax.Type.GetLeadingTrivia()) 874.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)
163if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 168if (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)
73leading: declarationExpression.GetLeadingTrivia(), 192var 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();