62 references to WithLeadingTrivia
Microsoft.CodeAnalysis (3)
Syntax\SyntaxNodeExtensions.cs (2)
342.WithLeadingTrivia(default(SyntaxTriviaList)); 352var newFirst = first.WithLeadingTrivia(trivia);
Syntax\SyntaxToken.cs (1)
454return this.WithLeadingTrivia(token.LeadingTrivia).WithTrailingTrivia(token.TrailingTrivia);
Microsoft.CodeAnalysis.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
769return token.WithLeadingTrivia(default(SyntaxTriviaList));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
111=> token.WithLeadingTrivia(leading).WithTrailingTrivia(trailing);
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (1)
55(original, current) => current.WithLeadingTrivia(current.LeadingTrivia.Insert(0, endOfLineTrivia)));
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
111currentToken = currentToken.WithLeadingTrivia(leadingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
51newToken = newToken.WithLeadingTrivia(newToken.LeadingTrivia.Add(syntaxGenerator.EndOfLine(options.FormattingOptions.NewLine)));
Microsoft.CodeAnalysis.CSharp (3)
Syntax\CSharpSyntaxRewriter.cs (2)
91token = token.WithLeadingTrivia(leading); 99return leading.Node != leadingTrivia ? token.WithLeadingTrivia(leading) : token;
Syntax\SyntaxNormalizer.cs (1)
97tk = tk.WithLeadingTrivia(RewriteTrivia(
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (8)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
309withoutBlankLine = token.WithLeadingTrivia(leadingTrivia.RemoveAt(0));
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
761XmlTextLiteral(" ").WithLeadingTrivia(exteriorTrivia));
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
433var newFirstToken = firstToken.WithLeadingTrivia(newLeadingTrivia);
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (2)
77replacementMap[colonToken] = colonToken.WithLeadingTrivia(colonToken.LeadingTrivia.AddRange(colonToken.TrailingTrivia).AddRange(thisBaseKeyword.LeadingTrivia)) 97replacementMap[colonToken] = colonToken.WithLeadingTrivia(thisBaseKeyword.LeadingTrivia).WithTrailingTrivia(SyntaxFactory.Space);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
132=> token.WithLeadingTrivia(token.LeadingTrivia.Insert(0, trivia));
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (1)
65.WithLeadingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Skip(trailingTriviaTakeUntil)))
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
640return token.WithLeadingTrivia(TriviaList(result));
Microsoft.CodeAnalysis.CSharp.Features (12)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
174return root.ReplaceToken(firstToken, firstToken.WithLeadingTrivia(existingTriviaList.InsertRange(insertionIndex, [nullableDisableTrivia, newLine, newLine])));
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (1)
168newToken = newToken.WithLeadingTrivia(newToken.LeadingTrivia.Add(Whitespace(indentation)));
EmbeddedLanguages\EmbeddedLanguageUtilities.cs (1)
17var newStringLiteral = stringLiteral.WithLeadingTrivia(
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
510identifier = identifier.WithLeadingTrivia(identifierLeadingTrivia);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
309withoutBlankLine = token.WithLeadingTrivia(leadingTrivia.RemoveAt(0));
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
761XmlTextLiteral(" ").WithLeadingTrivia(exteriorTrivia));
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
433var newFirstToken = firstToken.WithLeadingTrivia(newLeadingTrivia);
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (2)
77replacementMap[colonToken] = colonToken.WithLeadingTrivia(colonToken.LeadingTrivia.AddRange(colonToken.TrailingTrivia).AddRange(thisBaseKeyword.LeadingTrivia)) 97replacementMap[colonToken] = colonToken.WithLeadingTrivia(thisBaseKeyword.LeadingTrivia).WithTrailingTrivia(SyntaxFactory.Space);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
132=> token.WithLeadingTrivia(token.LeadingTrivia.Insert(0, trivia));
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (1)
65.WithLeadingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Skip(trailingTriviaTakeUntil)))
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
640return token.WithLeadingTrivia(TriviaList(result));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (3)
Syntax\SyntaxNodeTests.cs (1)
3611emptyToken = emptyToken.WithLeadingTrivia(emptyTriviaList).WithTrailingTrivia(emptyTriviaList);
Syntax\SyntaxRewriterTests.cs (2)
568var rewriter = new RedRewriter(rewriteToken: tok => tok.Kind() == SyntaxKind.IdentifierToken ? tok.WithLeadingTrivia(trivia) : tok); 614var rewriter = new RedRewriter(rewriteToken: tok => tok.Kind() == SyntaxKind.IdentifierToken ? tok.WithLeadingTrivia(trivia) : tok);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Rename\CSharpRenameRewriterLanguageService.cs (1)
719newToken = newToken.WithLeadingTrivia(updatedToken.LeadingTrivia);
Simplification\Simplifiers\NameSimplifier.cs (1)
317simpleName.Identifier.WithLeadingTrivia(
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
Formatting\FormattingTriviaTests.cs (1)
1788.WithLeadingTrivia(SyntaxFactory.TriviaList())
Microsoft.CodeAnalysis.Features (3)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
114? token.WithLeadingTrivia(triviaList)
ConvertToInterpolatedString\AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs (1)
140.WithLeadingTrivia(pieces.First().GetLeadingTrivia());
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
111currentToken = currentToken.WithLeadingTrivia(leadingTrivia);
Microsoft.CodeAnalysis.VisualBasic (2)
Syntax\SyntaxNormalizer.vb (1)
134newToken = newToken.WithLeadingTrivia(
Syntax\VisualBasicSyntaxRewriter.vb (1)
50token = token.WithLeadingTrivia(leading)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (1)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
120iteratorToken = iteratorToken.WithLeadingTrivia(leadingTrivia)
Microsoft.CodeAnalysis.VisualBasic.Features (5)
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (2)
200.WithLeadingTrivia(exitStatement.BlockKeyword.LeadingTrivia) _ 219.WithLeadingTrivia(continueStatement.BlockKeyword.LeadingTrivia) _
ConvertForEachToFor\VisualBasicConvertForEachToForCodeRefactoringProvider.vb (1)
85.WithLeadingTrivia(controlVariable.GetFirstToken().LeadingTrivia) _
ExtractMethod\Extensions.vb (1)
416identifier = identifier.WithLeadingTrivia(declarationStatement.GetLeadingTrivia.AddRange(identifier.LeadingTrivia))
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
120iteratorToken = iteratorToken.WithLeadingTrivia(leadingTrivia)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
CaseCorrection\VisualBasicCaseCorrectionService.Rewriter.vb (2)
279Return SyntaxFactory.ParseToken(expectedText).WithLeadingTrivia(token.LeadingTrivia).WithTrailingTrivia(token.TrailingTrivia) 294Return SyntaxFactory.ParseToken(expectedText).WithLeadingTrivia(token.LeadingTrivia).WithTrailingTrivia(token.TrailingTrivia)
Rename\VisualBasicRenameRewriterLanguageService.vb (1)
652newToken = newToken.WithLeadingTrivia(updatedToken.LeadingTrivia)
Microsoft.CodeAnalysis.Workspaces (6)
Editing\SyntaxGenerator.cs (2)
1072return token.WithLeadingTrivia(RemoveCommentLines(token.LeadingTrivia)) 1501replacement.WithLeadingTrivia(original.LeadingTrivia.AddRange(replacement.LeadingTrivia))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
769return token.WithLeadingTrivia(default(SyntaxTriviaList));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
111=> token.WithLeadingTrivia(leading).WithTrailingTrivia(trailing);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
563.WithLeadingTrivia(modifier.LeadingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
51newToken = newToken.WithLeadingTrivia(newToken.LeadingTrivia.Add(syntaxGenerator.EndOfLine(options.FormattingOptions.NewLine)));
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
VisualStudioMSBuildWorkspaceTests.cs (1)
341var newDecl = decl.WithIdentifier(CS.SyntaxFactory.Identifier("Pogrom").WithLeadingTrivia(decl.Identifier.LeadingTrivia).WithTrailingTrivia(decl.Identifier.TrailingTrivia));
Microsoft.VisualStudio.LanguageServices.CSharp (3)
CodeModel\CSharpCodeModelService.cs (3)
3298.ReplaceToken(nextToken, nextToken.WithLeadingTrivia(SyntaxTriviaList.Empty)); 3304.ReplaceToken(firstToken, firstToken.WithLeadingTrivia(triviaList)); 3354container = container.ReplaceToken(firstToken, firstToken.WithLeadingTrivia(SyntaxTriviaList.Empty));
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
CodeModel\VisualBasicCodeModelService.vb (1)
3819container = container.ReplaceToken(firstToken, firstToken.WithLeadingTrivia(SyntaxTriviaList.Empty))