81 references to ReplaceToken
Microsoft.AspNetCore.App.CodeFixes (2)
Authorization\AddAuthorizationBuilderFixer.cs (1)
80var addAuthorizationBuilderMethod = memberAccessExpression.ReplaceToken(identifierToken,
Http\HeaderDictionaryAddFixer.cs (1)
91invocation = invocationExpression.ReplaceToken(identifierToken, SyntaxFactory.Identifier("Append"));
Microsoft.CodeAnalysis (4)
Syntax\SyntaxNodeExtensions.cs (4)
353return node.ReplaceToken(first, newFirst); 365return node.ReplaceToken(first, newFirst); 397return node.ReplaceToken(last, newLast); 409return node.ReplaceToken(last, newLast);
Microsoft.CodeAnalysis.CodeStyle.Fixes (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
542return node.ReplaceToken(tokenToInsertTrivia, tokenWithInsertedTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
53var newRoot = document.Root.ReplaceToken(token, newToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
42root = root.ReplaceToken(firstToken, newFirstToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
242: nodeOrToken.Parent.ReplaceToken(nodeOrToken.AsToken(), currentNodeOrToken.AsToken());
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
290converted = converted.ReplaceToken(firstBodyToken, firstBodyTokenWithoutBlankLine);
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
435return compilationUnit.ReplaceToken(firstToken, newFirstToken);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
92? newIf.ReplaceToken(newIf.CloseParenToken, newIf.CloseParenToken.WithTrailingTrivia(trivia))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
111return destination.ReplaceToken(lastToken, updatedToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (1)
63return rewrittenNode.ReplaceToken(firstRewrittenToken, rewrittenTokenWithLeadingElasticTrivia);
Microsoft.CodeAnalysis.CSharp.Features (6)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
174return root.ReplaceToken(firstToken, firstToken.WithLeadingTrivia(existingTriviaList.InsertRange(insertionIndex, [nullableDisableTrivia, newLine, newLine])));
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.ConvertValueToParamRewriter.cs (1)
22=> name.ReplaceToken(name.LocalName, SyntaxFactory.Identifier("param"));
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.ConvertValueToReturnsRewriter.cs (1)
22=> name.ReplaceToken(name.LocalName, SyntaxFactory.Identifier("returns"));
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
290converted = converted.ReplaceToken(firstBodyToken, firstBodyTokenWithoutBlankLine);
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
435return compilationUnit.ReplaceToken(firstToken, newFirstToken);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
92? newIf.ReplaceToken(newIf.CloseParenToken, newIf.CloseParenToken.WithTrailingTrivia(trivia))
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (12)
IncrementalParsing\IncrementalParsingTests.cs (1)
3056var oldRoot = tempRoot.ReplaceToken(tempToken, tempToken.WithAdditionalAnnotations(new SyntaxAnnotation()));
Syntax\SyntaxAnnotationTests.cs (4)
197var newRoot = tree.GetCompilationUnitRoot().ReplaceToken(token, annotatedToken); 207var twiceAnnotatedRoot = newRoot.ReplaceToken(token2, twiceAnnotatedToken); 539return root.ReplaceToken(oldNodeOrToken.AsToken(), newNodeOrToken.AsToken()); 590newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceToken(nodeOrToken.AsToken(), newToken);
Syntax\SyntaxNodeTests.cs (5)
2232var expr2 = expr.ReplaceToken(bToken, SyntaxFactory.ParseToken("c")); 2254var cu1 = cu.ReplaceToken(privateToken, publicToken); 2319var expr2 = expr.ReplaceToken(token, SyntaxFactory.Token(token.Kind())); 2334var expr2 = expr.ReplaceToken(token, SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.Whitespace("garbage")), token.Kind(), default(SyntaxTriviaList))); 2347var cu2 = cu.ReplaceToken(token, SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.Whitespace(" ")), token.Kind(), default(SyntaxTriviaList)));
Syntax\SyntaxRewriterTests.cs (2)
338Assert.Same(tree, tree.GetCompilationUnitRoot().ReplaceToken(tokenT, tokenT).SyntaxTree); 339var newRoot = tree.GetCompilationUnitRoot().ReplaceToken(tokenT, SyntaxFactory.Identifier("U"));
Microsoft.CodeAnalysis.CSharp.Workspaces (8)
Simplification\CSharpSimplificationService.Expander.cs (1)
521replacement = replacement.ReplaceToken(identifier, GetNewIdentifier(identifierReplacement.Identifier));
Simplification\Simplifiers\NameSimplifier.cs (1)
315simpleName = simpleName.ReplaceToken(simpleName.Identifier,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
111return destination.ReplaceToken(lastToken, updatedToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (2)
189resultCompilationUnit = resultCompilationUnit.ReplaceToken(firstToken, newFirstToken); 241resultNamespace = resultNamespace.ReplaceToken(firstToken, newFirstToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
100rewritten = rewritten.ReplaceToken(braces.closeBrace, closeBrace); 108rewritten = rewritten.ReplaceToken(braces.closeBrace,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (1)
63return rewrittenNode.ReplaceToken(firstRewrittenToken, rewrittenTokenWithLeadingElasticTrivia);
Microsoft.CodeAnalysis.Features (6)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (2)
44newEndToken = root.ReplaceToken(startToken, newStartToken.WithAdditionalAnnotations(annotation)).GetAnnotatedTokens(annotation).Single(); 54newNode = nodeWithTokens.ReplaceToken(startToken, newEndToken);
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (1)
136var finalRoot = root.ReplaceToken(
ConvertNumericLiteral\AbstractConvertNumericLiteralCodeRefactoringProvider.cs (1)
126var updatedRoot = root.ReplaceToken(numericToken, updatedToken);
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (1)
431return name.ReplaceToken(
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
223var newRoot = root.ReplaceToken(nameToken, CreateIdentifier(nameToken, newName));
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (1)
151newCompilationUnit = newCompilationUnit.ReplaceToken(firstToken, newFirstToken)
Microsoft.CodeAnalysis.VisualBasic.Features (4)
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.ReplaceTokenKeywordCodeAction.vb (1)
34Dim rootWithoutToken = root.ReplaceToken(_invalidToken, SyntaxFactory.Token(BlockKindToKeywordKind(_blockKind)))
GenerateType\VisualBasicGenerateTypeService.vb (1)
646memberImportsClause = memberImportsClause.ReplaceToken(lastToken, lastTokenWithEndOfLineTrivia)
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.ConvertValueToParamRewriter.vb (1)
21Return name.ReplaceToken(DirectCast(name, XmlNameSyntax).LocalName,
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.ConvertValueToReturnsRewriter.vb (1)
21Return name.ReplaceToken(DirectCast(name, XmlNameSyntax).LocalName,
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (6)
Syntax\SyntaxAnnotationTests.vb (4)
182Dim newRoot = tree.GetRoot().ReplaceToken(token, annotatedToken) 192Dim twiceAnnotatedRoot = newRoot.ReplaceToken(token2, twiceAnnotatedToken) 496Return root.ReplaceToken(oldNodeOrToken.AsToken(), newNodeOrToken.AsToken()) 537newRoot = tree.GetRoot().ReplaceToken(nodeOrToken.AsToken(), newToken)
TestSyntaxNodes.vb (2)
1264simpleTree = simpleTree.ReplaceToken(op, SyntaxFactory.MissingPunctuation(SyntaxKind.MinusToken)) 1499Dim cu1 = cu.ReplaceToken(privateToken, publicToken)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (7)
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (1)
469Return originalParent.ReplaceToken(tokenToFix, replacementToken)
CodeCleanup\Providers\FixIncorrectTokensCodeCleanupProvider.vb (1)
139Return newIdentifierName.ReplaceToken(id, CreateIdentifierToken(id, newValueText))
CodeCleanup\Providers\ReduceTokensCodeCleanupProvider.vb (3)
66Return newNode.ReplaceToken(literal, CreateLiteralToken(literal, valueText, value)) 83Return newNode.ReplaceToken(literal, CreateLiteralToken(literal, valueText, value)) 108Return newNode.ReplaceToken(literal, CreateLiteralToken(literal, valueText, value))
Simplification\VisualBasicSimplificationService.Expander.vb (1)
554replacement = replacement.ReplaceToken(identifier, newIdentifier)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (1)
151newCompilationUnit = newCompilationUnit.ReplaceToken(firstToken, newFirstToken)
Microsoft.CodeAnalysis.Workspaces (7)
Editing\SyntaxGenerator.cs (1)
1505return root.ReplaceToken(original, combinedTriviaReplacement);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
542return node.ReplaceToken(tokenToInsertTrivia, tokenWithInsertedTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (2)
182return newBinaryExpressionSyntax.ReplaceToken( 259return newPattern.ReplaceToken(newToken, newTokenWithTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
53var newRoot = document.Root.ReplaceToken(token, newToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
42root = root.ReplaceToken(firstToken, newFirstToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
242: nodeOrToken.Parent.ReplaceToken(nodeOrToken.AsToken(), currentNodeOrToken.AsToken());
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
BatchFixAllProviderTests.cs (1)
128return document.WithSyntaxRoot(root.ReplaceToken(token, newToken));
CodeCleanup\CodeCleanupTests.cs (2)
353root = root.ReplaceToken(previousToken, CSharp.SyntaxFactory.Identifier(previousToken.LeadingTrivia, previousToken.ValueText, previousToken.TrailingTrivia)); 354root = root.ReplaceToken(nextToken, CSharp.SyntaxFactory.Token(nextToken.LeadingTrivia, CSharp.CSharpExtensions.Kind(nextToken), nextToken.TrailingTrivia));
Microsoft.VisualStudio.LanguageServices.CSharp (4)
CodeModel\CSharpCodeModelService.cs (4)
3247return enumDeclaration.ReplaceToken(separator, separator.WithTrailingTrivia(trailingTrivia)); 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))
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
190newMethod = newMethod.ReplaceToken(newMethod.Identifier, SyntaxFactory.Identifier(methodName).WithAdditionalAnnotations(RenameAnnotation.Create()));