186 instantiations of TextChange
dotnet (3)
Commands\Run\FileBasedAppSourceEditor.cs (3)
94return new TextChange(toReplace.Info.Span, newText: directive.ToString() + NewLine); 123return new TextChange(span, newText: directive.ToString() + NewLine); 226return new TextChange(new TextSpan(start: start, length: 0), newText: prefix + directive.ToString() + suffix);
dotnet-format (3)
Formatters\EndOfLineFormatter.cs (1)
55changes.Add(new TextChange(lineEndingSpan, endOfLine));
Formatters\FinalNewlineFormatter.cs (2)
44var addNewlineChange = new TextChange(finalNewlineSpan, endOfLine); 54var removeNewlineChange = new TextChange(finalNewlineSpan, string.Empty);
GenerateDocumentationAndConfigFiles (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.AspNetCore.App.Analyzers (4)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (2)
88new TextChange(new TextSpan(int.Parse(startString, CultureInfo.InvariantCulture), int.Parse(lengthString, CultureInfo.InvariantCulture)), newText), 529new TextChange(replacementSpan, insertionText),
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (2)
82new TextChange(new TextSpan(int.Parse(startString, CultureInfo.InvariantCulture), int.Parse(lengthString, CultureInfo.InvariantCulture)), newText), 381new TextChange(replacementSpan, escapedInsertionText),
Microsoft.CodeAnalysis (4)
Syntax\SyntaxDiffer.cs (2)
46return new[] { new TextChange(new TextSpan(0, 0), after.GetText().ToString()) }; 69return reducedChanges.Select(c => new TextChange(c.Range.Span, c.NewText!)).ToList();
Text\SourceText.cs (2)
880return this.WithChanges(new TextChange(span, newText)); 941textChanges.Add(new TextChange(range.Span, newt));
Microsoft.CodeAnalysis.Analyzers (6)
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (1)
176var textChange = new TextChange(fixInfo.AdditionalDocumentSpanToFix.Value, fixInfo.FixValue);
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs (1)
139textChanges.Add(new TextChange(inputSpanToFix, fixInfo.FixValue));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.AnalyzerUtilities (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.CodeStyle (6)
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
74change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.CodeStyle.Fixes (8)
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (8)
334edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 338edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 347edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 351edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 360edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 366edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 372edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 377edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
279changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 389changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
174return new TextChange( 235return new TextChange(new TextSpan(textLine.Start, 0), newText: indentation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
91edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 92edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
93edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.Features (37)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (3)
125document = GetUpdatedDocument(document, [new TextChange(closingToken.FullSpan, newClosingToken.ToFullString())], rootToFormat); 129newLineEdit = new TextChange(new TextSpan(annotatedNewline.SpanStart, 0), annotatedNewline.ToString()); 212mergedChanges.Add(new TextChange(newTextChangeSpan, newTextChangeText));
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (4)
259return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - SpaceEqualsString.Length)); 266return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - EqualsString.Length)); 273return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - ColonString.Length)); 277return new TextChange(selectedItem.Span, displayText);
Completion\CompletionProviders\AwaitCompletionProvider.cs (1)
76return new TextChange(existingReturnType.Span, newTypeName);
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
369return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
264return Task.FromResult<TextChange?>(new TextChange(
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
200new TextChange(TextSpan.FromBounds(replacementStart, tokenOnLeft.Span.End), text),
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (5)
95builder.Add(new TextChange(new TextSpan(expression.SpanStart, 0), castText)); 107builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), ")")); 112builder.Add(new TextChange(new TextSpan(questionToken.Value.SpanStart, 0), ")")); 114builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), "")); 120builder.Add(new TextChange(tokenOnLeft.Span, ""));
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
144var fullTextChange = new TextChange(
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (1)
85return new TextChange(selectedItem.Span, insertionText);
Completion\CompletionProviders\TupleNameCompletionProvider.cs (1)
118return Task.FromResult<TextChange?>(new TextChange(
Copilot\CSharpCopilotProposalAdjusterService.cs (1)
49d => new TextChange(new TextSpan(d.Location.SourceSpan.Start, 0), "}"));
InlineHints\CSharpInlineTypeHintsService.cs (3)
81? new TypeHint(parameter.Type, span, textChange: new TextChange(span, GetTypeDisplayString(parameter.Type) + " "), trailingSpace: true) 95return new(type, span, new TextChange(span, " " + GetTypeDisplayString(type)), leadingSpace: true); 134return new TypeHint(type, span, new TextChange(displayAllSpan.Span, GetTypeDisplayString(type)), trailingSpace: trailingSpace);
RawStringLiteral\CSharpRawStringLiteralOnAutoInsertService.cs (3)
71return new TextChange(new TextSpan(position + 1, 0), "\"\"\""); 123return new TextChange(new TextSpan(position + 1, 0), "\""); 175return new TextChange(new TextSpan(token.GetRequiredParent().Span.End, 0), "\"");
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
81return new TextChange(TextSpan.FromBounds(targetPosition, targetPosition), SyntaxFacts.GetText(SyntaxKind.PublicKeyword) + " ");
Snippets\CSharpConstructorSnippetProvider.cs (1)
75return new TextChange(TextSpan.FromBounds(position, position), constructorDeclaration.NormalizeWhitespace().ToFullString());
Snippets\CSharpElseSnippetProvider.cs (1)
60return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), elseClause.ToFullString()));
Snippets\CSharpSnippetFunctionService.cs (1)
55var textChange = new TextChange(caseGenerationLocation, str);
Snippets\CSharpUnsafeSnippetProvider.cs (1)
27=> Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), SyntaxFactory.UnsafeStatement().ToFullString()));
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
174return new TextChange( 235return new TextChange(new TextSpan(textLine.Start, 0), newText: indentation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
91edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 92edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
93edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
279changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 389changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Microsoft.CodeAnalysis.Features (63)
BraceCompletion\AbstractBraceCompletionService.cs (1)
61var braceTextEdit = new TextChange(TextSpan.FromBounds(closingPoint, closingPoint), ClosingBrace.ToString());
CodeFixes\Configuration\ConfigurationUpdater.cs (6)
447var textChange = new TextChange(); 500textChange = new TextChange(curLine.Span, $"{untrimmedKey}={newOptionValue}{newSeverityValue}{commentValue}"); 556textChange = new TextChange(curLine.Span, $"{untrimmedKey}={newSeverityValue}{commentValue}"); 720var textChange = new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry); 730var textChange = new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry); 768var textChange = new TextChange(new TextSpan(result.Length, 0), prefix + newEntry);
Completion\CommonCompletionProvider.cs (2)
83new TextChange(item.Span, item.DisplayText); 113?? new TextChange(item.Span, item.DisplayText);
Completion\CompletionProvider.cs (1)
78=> Task.FromResult(CompletionChange.Create(new TextChange(item.Span, item.DisplayText)));
Completion\CompletionService.cs (2)
252return CompletionChange.Create(new TextChange(new TextSpan(), "")); 260return CompletionChange.Create(new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractAwaitCompletionProvider.cs (4)
196var asyncChange = new TextChange(new TextSpan(GetAsyncKeywordInsertionPosition(declaration), 0), syntaxFacts.GetText(syntaxKinds.AsyncKeyword) + " "); 221builder.Add(new TextChange(TextSpan.FromBounds(item.Span.Start, currentSpanEnd), _awaitKeyword)); 233builder.Add(new TextChange(new TextSpan(expr.SpanStart, 0), _awaitKeyword + " ")); 240builder.Add(new TextChange(TextSpan.FromBounds(dotToken.Value.SpanStart, currentSpanEnd), replacementText));
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
329new TextChange(replacementSpan, replacementText),
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
280var textChange = new TextChange(item.Span, assemblyName);
Completion\Providers\AbstractKeywordCompletionProvider.cs (1)
76=> Task.FromResult((TextChange?)new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
250var textChange = new TextChange(text.Lines[lineNumber].SpanIncludingLineBreak, string.Empty);
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (1)
116return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
499=> Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, GetInsertionText(selectedItem, ch)));
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (3)
138return CompletionChange.Create(new TextChange(completionItem.Span, insertText)); 144return CompletionChange.Create(new TextChange(completionItem.Span, completionText)); 169builder.Add(new TextChange(completionItem.Span, insertText));
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (2)
57change = new TextChange(textSpan, snippetText); 128var textChange = new TextChange(span, string.Empty);
Completion\Utilities.cs (2)
22return new TextChange(new TextSpan(0, 0), ""); 42return new TextChange(totalOldSpan, newText.ToString(totalNewSpan));
Copilot\IProposalAdjusterService.cs (5)
239result.Add(changed ? new TextChange(span, newText) : change); 322result.Add(new TextChange(beforeSpan, beforeText)); 327result.Add(new TextChange(afterSpan, afterText)); 335result.Add(new TextChange( 345result.Add(new TextChange(
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
227new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText)));
EmbeddedLanguages\DateAndTime\EmbeddedCompletionContext.cs (1)
145new TextChange(_replacementSpan, displayText)),
EmbeddedLanguages\RegularExpressions\LanguageServices\EmbeddedCompletionContext.cs (1)
64new TextChange(replacementSpan, escapedInsertionText),
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (2)
288new TextChange(new TextSpan(context.Position, 0), name), newPosition: null))); 456new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText),
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
111: new TextChange(textSpan, GetReplacementText(parameter.Name));
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (3)
183new TextChange(condition.FullSpan, invertedCondition.ToFullString()), 184new TextChange(trueSpan, text.ToString(falseSpan)), 185new TextChange(falseSpan, text.ToString(trueSpan)));
Snippets\RoslynLSPSnippetConverter.cs (1)
113var newTextChange = new TextChange(extendedSpan, newString);
Snippets\SnippetFunctionService.cs (1)
44var textChange = new TextChange(fieldSpan, fullyQualifiedTypeName);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
55var change = new TextChange(TextSpan.FromBounds(position, position), resultingNode.ToFullString());
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (1)
69return new TextChange(TextSpan.FromBounds(inlineExpressionInfo?.Node.SpanStart ?? position, position), statement.ToFullString());
Snippets\SnippetProviders\AbstractLockSnippetProvider.cs (1)
19return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), statement.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractMainMethodSnippetProvider.cs (1)
34return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), method.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractPropertySnippetProvider.cs (1)
24return new TextChange(TextSpan.FromBounds(position, position), propertyDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (1)
35var mainChange = new TextChange(TextSpan.FromBounds(position, position), typeDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractUsingSnippetProvider.cs (1)
24return new TextChange(TextSpan.FromBounds(position, position), statement.NormalizeWhitespace().ToFullString());
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
74change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (8)
334edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 338edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 347edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 351edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 360edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 366edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 372edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 377edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
Wrapping\AbstractCodeActionComputer.cs (1)
91new TextChange(TextSpan.FromBounds(nodeOrToken.Span.End, OriginalSourceText.Length), newLine));
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
186changes.Add(New TextChange(trivia.FullSpan, lineContinuation.ToFullString())) 257changes.Add(New TextChange(trivia.FullSpan, docComment.ToFullString()))
Microsoft.CodeAnalysis.VisualBasic.Features (6)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (1)
252Dim updatedText = text.WithChanges(New TextChange(TextSpan.FromBounds(insertionPoint, insertionPoint), stringToAppend))
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.MoveToLineCodeAction.vb (1)
38Dim textWithoutLine = text.WithChanges(New TextChange(textLineToMove.SpanIncludingLineBreak, ""))
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (3)
202change = New TextChange(symbolItem.Span, insertionText.Substring(0, insertionText.Length - s_colonEquals.Length)) 204change = New TextChange(selectedItem.Span, insertionText.Substring(0, insertionText.Length - (s_colonEquals.Length - 1))) 206change = New TextChange(symbolItem.Span, insertionText)
Completion\CompletionProviders\PartialTypeCompletionProvider.vb (1)
76Return New TextChange(selectedItem.Span, insertionText)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
186changes.Add(New TextChange(trivia.FullSpan, lineContinuation.ToFullString())) 257changes.Add(New TextChange(trivia.FullSpan, docComment.ToFullString()))
Microsoft.CodeAnalysis.Workspaces (9)
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (2)
75var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText!)); 84commentChanges.Add(new TextChange(TextSpan.FromBounds(startLineStartPosition, startLineStartPosition), warningText));
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (2)
245combinedChanges.Add(new TextChange(conflictingCommentInsertionLocation, commentChangesList[commentChangeIndex].NewText!)); 283currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
41var newTextChange = new TextChange(mappedSpanResults[i].Span, newText);
Roslyn.Diagnostics.Analyzers (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Roslyn.Diagnostics.CSharp.Analyzers (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
279changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 389changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Roslyn.Diagnostics.VisualBasic.Analyzers (3)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
186changes.Add(New TextChange(trivia.FullSpan, lineContinuation.ToFullString())) 257changes.Add(New TextChange(trivia.FullSpan, docComment.ToFullString()))
675 references to TextChange
dotnet (2)
Commands\Run\FileBasedAppSourceEditor.cs (2)
82var change = DetermineAddChange(directive); 86private TextChange DetermineAddChange(CSharpDirective directive)
dotnet-format (7)
Formatters\DocumentFormatter.cs (2)
166var change = changes[index]; 185static string BuildChangeMessage(TextChange change)
Formatters\EndOfLineFormatter.cs (1)
36var changes = new List<TextChange>();
Formatters\FinalNewlineFormatter.cs (2)
44var addNewlineChange = new TextChange(finalNewlineSpan, endOfLine); 54var removeNewlineChange = new TextChange(finalNewlineSpan, string.Empty);
Formatters\WhitespaceFormatter.cs (2)
42/// Returns a formatted <see cref="SourceText"/> with a single <see cref="TextChange"/> that encompasses the entire document. 51/// Returns a formatted <see cref="SoureText"/> with multiple <see cref="TextChange"/>s for each formatting change.
GenerateDocumentationAndConfigFiles (36)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (6)
23private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 38_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 60public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 66private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 80private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 89var result = new List<TextChange>(count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (7)
20private readonly CancellableLazy<IList<TextChange>> _lazyChanges; 37_lazyChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 48public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 54private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 60var result = new List<TextChange>(); 76private void AddTextChanges(List<TextChange> list, SyntaxToken token1, SyntaxToken token2, TriviaData data) 81foreach (var change in data.GetTextChanges(span))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (10)
189protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 265public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 267using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 674private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 702var change = GetWhitespaceTextChange( 712private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 719var change = changes[i]; 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (2)
16ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter(ParsedDocument document, int caretPosition, IndentationOptions indentationOptions, CancellationToken cancellationToken); 17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (3)
59public ParsedDocument WithChange(TextChange change, CancellationToken cancellationToken) 62public ParsedDocument WithChanges(IEnumerable<TextChange> changes, CancellationToken cancellationToken) 68public IEnumerable<TextChange> GetChanges(in ParsedDocument oldDocument)
Microsoft.AspNetCore.App.Analyzers (2)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
256var textChange = change.TextChange;
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
135var textChange = change.TextChange;
Microsoft.CodeAnalysis (29)
Syntax\SyntaxDiffer.cs (4)
38internal static IList<TextChange> GetTextChanges(SyntaxTree before, SyntaxTree after) 42return SpecializedCollections.EmptyList<TextChange>(); 59internal static IList<TextChange> GetTextChanges(SyntaxNode oldNode, SyntaxNode newNode) 64private IList<TextChange> ComputeTextChangesFromOld()
Syntax\SyntaxTree.cs (1)
366public abstract IList<TextChange> GetChanges(SyntaxTree oldTree);
Text\ChangedText.cs (1)
152public override SourceText WithChanges(IEnumerable<TextChange> changes)
Text\SourceText.cs (8)
767public virtual SourceText WithChanges(IEnumerable<TextChange> changes) 785foreach (var change in changes) 865/// Changes do not have to be in sorted order. However, <see cref="WithChanges(IEnumerable{TextChange})"/> will 870public SourceText WithChanges(params TextChange[] changes) 872return this.WithChanges((IEnumerable<TextChange>)changes); 914/// Gets the set of <see cref="TextChange"/> that describe how the text changed 918public virtual IReadOnlyList<TextChange> GetTextChanges(SourceText oldText) 923var textChanges = new List<TextChange>(ranges.Count);
Text\TextChange.cs (14)
19public readonly struct TextChange : IEquatable<TextChange> 34/// Initializes a new instance of <see cref="TextChange"/> 51/// Provides a string representation for <see cref="TextChange"/>. 60return obj is TextChange && this.Equals((TextChange)obj); 63public bool Equals(TextChange other) 75public static bool operator ==(TextChange left, TextChange right) 80public static bool operator !=(TextChange left, TextChange right) 86/// Converts a <see cref="TextChange"/> to a <see cref="TextChangeRange"/>. 89public static implicit operator TextChangeRange(TextChange change) 98public static IReadOnlyList<TextChange> NoChanges => SpecializedCollections.EmptyReadOnlyList<TextChange>();
Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
Microsoft.CodeAnalysis.Analyzers (38)
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (1)
176var textChange = new TextChange(fixInfo.AdditionalDocumentSpanToFix.Value, fixInfo.FixValue);
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs (1)
132using var _1 = ArrayBuilder<TextChange>.GetInstance(fixInfos.Count, out var textChanges);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (6)
23private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 38_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 60public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 66private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 80private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 89var result = new List<TextChange>(count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (7)
20private readonly CancellableLazy<IList<TextChange>> _lazyChanges; 37_lazyChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 48public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 54private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 60var result = new List<TextChange>(); 76private void AddTextChanges(List<TextChange> list, SyntaxToken token1, SyntaxToken token2, TriviaData data) 81foreach (var change in data.GetTextChanges(span))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (10)
189protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 265public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 267using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 674private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 702var change = GetWhitespaceTextChange( 712private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 719var change = changes[i]; 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (2)
16ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter(ParsedDocument document, int caretPosition, IndentationOptions indentationOptions, CancellationToken cancellationToken); 17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (3)
59public ParsedDocument WithChange(TextChange change, CancellationToken cancellationToken) 62public ParsedDocument WithChanges(IEnumerable<TextChange> changes, CancellationToken cancellationToken) 68public IEnumerable<TextChange> GetChanges(in ParsedDocument oldDocument)
Microsoft.CodeAnalysis.AnalyzerUtilities (31)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (6)
23private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 38_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 60public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 66private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 80private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 89var result = new List<TextChange>(count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (7)
20private readonly CancellableLazy<IList<TextChange>> _lazyChanges; 37_lazyChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 48public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 54private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 60var result = new List<TextChange>(); 76private void AddTextChanges(List<TextChange> list, SyntaxToken token1, SyntaxToken token2, TriviaData data) 81foreach (var change in data.GetTextChanges(span))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (10)
189protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 265public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 267using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 674private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 702var change = GetWhitespaceTextChange( 712private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 719var change = changes[i]; 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.CodeStyle (33)
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
59foreach (var formattingChange in formattingChanges) 61var change = formattingChange;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (6)
23private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 38_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 60public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 66private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 80private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 89var result = new List<TextChange>(count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (7)
20private readonly CancellableLazy<IList<TextChange>> _lazyChanges; 37_lazyChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 48public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 54private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 60var result = new List<TextChange>(); 76private void AddTextChanges(List<TextChange> list, SyntaxToken token1, SyntaxToken token2, TriviaData data) 81foreach (var change in data.GetTextChanges(span))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (10)
189protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 265public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 267using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 674private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 702var change = GetWhitespaceTextChange( 712private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 719var change = changes[i]; 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.CodeStyle.Fixes (11)
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (6)
316Action<SourceText, ArrayBuilder<TextChange>, int, int, int, int> addEdits, 321using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 329SourceText text, ArrayBuilder<TextChange> edits, 342SourceText text, ArrayBuilder<TextChange> edits, 355SourceText text, ArrayBuilder<TextChange> edits, 412using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (2)
16ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter(ParsedDocument document, int caretPosition, IndentationOptions indentationOptions, CancellationToken cancellationToken); 17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (3)
59public ParsedDocument WithChange(TextChange change, CancellationToken cancellationToken) 62public ParsedDocument WithChanges(IEnumerable<TextChange> changes, CancellationToken cancellationToken) 68public IEnumerable<TextChange> GetChanges(in ParsedDocument oldDocument)
Microsoft.CodeAnalysis.CSharp (1)
Syntax\CSharpSyntaxTree.cs (1)
613public override IList<TextChange> GetChanges(SyntaxTree oldTree)
Microsoft.CodeAnalysis.CSharp.CodeStyle (8)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
270LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken) 361LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (2)
18private readonly IList<TextChange> _textChanges; 57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
44public IList<TextChange> FormatRange( 76public IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (4)
121using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 128TextChange? TryDedentLine(TextLine textLine) 205using var _ = ArrayBuilder<TextChange>.GetInstance(Math.Max(0, closeBraceLine - openBraceLine - 1), out var changes); 213private static TextChange? TryIndentLine(
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
47using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 67ArrayBuilder<TextChange> edits)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
47using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 68ArrayBuilder<TextChange> edits)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (4)
73public ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter( 185private static IList<TextChange> FormatToken( 192private static ImmutableArray<TextChange> FormatRange( 337public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.Features (38)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (8)
114TextChange? newLineEdit = null; 156static ParsedDocument GetUpdatedDocument(ParsedDocument oldDocument, IEnumerable<TextChange> changes, SyntaxNode newRoot) 181static ImmutableArray<TextChange> GetMergedChanges(TextChange? newLineEdit, ImmutableArray<TextChange> formattingChanges, SourceText formattedText) 198var mergedChanges = new FixedSizeArrayBuilder<TextChange>(newRanges.Length); 224private (SyntaxNode formattedRoot, ImmutableArray<TextChange> textChanges, int finalBraceEnd) FormatTrackingSpan( 264return (document.Root, ImmutableArray<TextChange>.Empty, closingPoint);
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (2)
246protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 249private static TextChange? GetTextChange(CompletionItem selectedItem, char? ch)
Completion\CompletionProviders\AwaitCompletionProvider.cs (1)
53protected override async Task<TextChange?> GetReturnTypeChangeAsync(
Completion\CompletionProviders\CrefCompletionProvider.cs (2)
362protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 369return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (2)
262protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 264return Task.FromResult<TextChange?>(new TextChange(
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (1)
91using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder);
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
144var fullTextChange = new TextChange(
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (1)
78public override async Task<TextChange?> GetTextChangeAsync(
Completion\CompletionProviders\TupleNameCompletionProvider.cs (2)
116protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 118return Task.FromResult<TextChange?>(new TextChange(
Copilot\CSharpCopilotProposalAdjusterService.cs (1)
39var lastTextChange = changes.Last();
RawStringLiteral\CSharpRawStringLiteralOnAutoInsertService.cs (4)
21public TextChange? GetTextChangeForQuote(Document document, SourceText text, int caretPosition, CancellationToken cancellationToken) 33private static TextChange? TryGenerateInitialEmptyRawString( 80private static TextChange? TryGrowInitialEmptyRawString( 131private static TextChange? TryGrowRawStringDelimiters(
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
47protected override async Task<TextChange?> GetAccessibilityModifiersChangeAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\CSharpConstructorSnippetProvider.cs (1)
59protected override async Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\CSharpElseSnippetProvider.cs (1)
57protected override Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\CSharpSnippetFunctionService.cs (1)
55var textChange = new TextChange(caseGenerationLocation, str);
Snippets\CSharpUnsafeSnippetProvider.cs (1)
26protected override Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (4)
121using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 128TextChange? TryDedentLine(TextLine textLine) 205using var _ = ArrayBuilder<TextChange>.GetInstance(Math.Max(0, closeBraceLine - openBraceLine - 1), out var changes); 213private static TextChange? TryIndentLine(
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
47using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 67ArrayBuilder<TextChange> edits)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
47using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 68ArrayBuilder<TextChange> edits)
Microsoft.CodeAnalysis.CSharp.Workspaces (12)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
270LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken) 361LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (2)
18private readonly IList<TextChange> _textChanges; 57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
44public IList<TextChange> FormatRange( 76public IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (4)
73public ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter( 185private static IList<TextChange> FormatToken( 192private static ImmutableArray<TextChange> FormatRange( 337public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (1)
AddPackage\AspNetCoreAddPackageCodeAction.cs (1)
55private static async Task<ImmutableArray<TextChange>> GetTextChangesAsync(
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (2)
InlineHints\OmniSharpInlineHintsService.cs (2)
40TextChange? replacementTextChange, 53public readonly TextChange? ReplacementTextChange { get; }
Microsoft.CodeAnalysis.Features (170)
AddImport\AddImportFixData.cs (6)
18ImmutableArray<TextChange> textChanges, 41public readonly ImmutableArray<TextChange> TextChanges = textChanges; 113public static AddImportFixData CreateForProjectSymbol(ImmutableArray<TextChange> textChanges, string title, ImmutableArray<string> tags, CodeActionPriority priority, ProjectId projectReferenceToAdd) 121public static AddImportFixData CreateForMetadataSymbol(ImmutableArray<TextChange> textChanges, string title, ImmutableArray<string> tags, CodeActionPriority priority, ProjectId portableExecutableReferenceProjectId, string portableExecutableReferenceFilePathToAdd) 130public static AddImportFixData CreateForReferenceAssemblySymbol(ImmutableArray<TextChange> textChanges, string title, string assemblyReferenceAssemblyName, string assemblyReferenceFullyQualifiedTypeName) 139public static AddImportFixData CreateForPackageSymbol(ImmutableArray<TextChange> textChanges, string packageSource, string packageName, string packageVersionOpt)
AddImport\CodeActions\AddImportCodeAction.cs (1)
37private readonly ImmutableArray<TextChange> _textChanges;
AddImport\References\MetadataSymbolReference.cs (1)
51Document document, ImmutableArray<TextChange> textChanges, string description,
AddImport\References\ProjectSymbolReference.cs (1)
75Document document, ImmutableArray<TextChange> textChanges, string description,
AddImport\References\Reference.cs (1)
103protected async Task<ImmutableArray<TextChange>> GetTextChangesAsync(
AddImport\References\SymbolReference.cs (2)
48private async Task<ImmutableArray<TextChange>> GetTextChangesAsync( 118Document document, ImmutableArray<TextChange> textChanges,
AddPackage\ParentInstallPackageCodeAction.cs (2)
27internal readonly struct InstallPackageData(string? packageSource, string packageName, string? packageVersionOpt, ImmutableArray<TextChange> textChanges) 33public readonly ImmutableArray<TextChange> TextChanges = textChanges;
BraceCompletion\AbstractBraceCompletionService.cs (1)
61var braceTextEdit = new TextChange(TextSpan.FromBounds(closingPoint, closingPoint), ClosingBrace.ToString());
BraceCompletion\IBraceCompletionService.cs (2)
73internal readonly struct BraceCompletionResult(ImmutableArray<TextChange> textChanges, LinePosition caretLocation) 79public ImmutableArray<TextChange> TextChanges { get; } = textChanges;
CodeFixes\Configuration\ConfigurationUpdater.cs (4)
447var textChange = new TextChange(); 720var textChange = new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry); 730var textChange = new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry); 768var textChange = new TextChange(new TextSpan(result.Length, 0), prefix + newEntry);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (6)
119private static async Task<IEnumerable<TextChange>> GetTextChangesAsync( 130private static void UpdateDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics, Dictionary<Diagnostic, TextSpan> currentDiagnosticSpans, IEnumerable<TextChange> textChanges) 132static bool IsPriorSpan(TextSpan span, TextChange textChange) => span.End <= textChange.Span.Start; 133static bool IsFollowingSpan(TextSpan span, TextChange textChange) => span.Start >= textChange.Span.End; 134static bool IsEnclosingSpan(TextSpan span, TextChange textChange) => span.Contains(textChange.Span); 146foreach (var textChange in textChanges)
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (5)
94using var _ = PooledHashSet<TextChange>.GetInstance(out var insertionOnlyChanges); 96var changes = ProducerConsumer<TextChange>.RunParallelStreamAsync( 107await foreach (var change in changes.ConfigureAwait(false)) 185Action<TextChange> callback, 224foreach (var change in textChanges)
Completion\CommonCompletionProvider.cs (5)
82var change = await GetTextChangeAsync(document, item, ch: '\t', cancellationToken: cancellationToken).ConfigureAwait(false) ?? 112var change = (await GetTextChangeAsync(document, item, commitKey, cancellationToken).ConfigureAwait(false)) 117public virtual Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 120protected virtual Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 121=> SpecializedTasks.Default<TextChange?>();
Completion\CompletionChange.cs (20)
21public TextChange TextChange { get; } 28public ImmutableArray<TextChange> TextChanges { get; } 52TextChange textChange, ImmutableArray<TextChange> textChanges, int? newPosition, bool includesCommitCharacter) 58TextChange textChange, ImmutableArray<TextChange> textChanges, int? newPosition, bool includesCommitCharacter, ImmutableDictionary<string, string> properties) 64TextChange textChange, ImmutableArray<TextChange> textChanges, TextSpan? newSelection, bool includesCommitCharacter, ImmutableDictionary<string, string> properties) 86/// are multiple entries, <see cref="Create(TextChange, ImmutableArray{TextChange}, int?, bool)"/> must be called instead, 91ImmutableArray<TextChange> textChanges, 101TextChange textChange, 113TextChange textChange, 114ImmutableArray<TextChange> textChanges, 122TextChange textChange, 123ImmutableArray<TextChange> textChanges, 132TextChange textChange, 133ImmutableArray<TextChange> textChanges, 144public CompletionChange WithTextChange(TextChange textChange) 150public CompletionChange WithTextChanges(ImmutableArray<TextChange> textChanges)
Completion\Providers\AbstractAwaitCompletionProvider.cs (3)
60protected abstract Task<TextChange?> GetReturnTypeChangeAsync(Solution solution, SemanticModel semanticModel, SyntaxNode declaration, CancellationToken cancellationToken); 175using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder); 196var asyncChange = new TextChange(new TextSpan(GetAsyncKeywordInsertionPosition(declaration), 0), syntaxFacts.GetText(syntaxKinds.AsyncKeyword) + " ");
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
280var textChange = new TextChange(item.Span, assemblyName);
Completion\Providers\AbstractKeywordCompletionProvider.cs (2)
75public sealed override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem item, char? ch, CancellationToken cancellationToken) 76=> Task.FromResult((TextChange?)new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (2)
55var change = Utilities.Collapse(newText, changesArray); 250var textChange = new TextChange(text.Lines[lineNumber].SpanIncludingLineBreak, string.Empty);
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (2)
113public override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 116return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\Providers\AbstractSymbolCompletionProvider.cs (2)
498public sealed override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 499=> Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, GetInsertionText(selectedItem, ch)));
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (2)
152using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder); 176var change = Utilities.Collapse(newText, changes);
Completion\Providers\ImportCompletionProvider\ImportCompletionProviderHelpers.cs (1)
21public static async Task<ImmutableArray<TextChange>> GetAddImportTextChangesAsync(
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (2)
46var change = Utilities.Collapse(allChangesText, allTextChanges.AsImmutable()); 128var textChange = new TextChange(span, string.Empty);
Completion\Utilities.cs (2)
18public static TextChange Collapse(SourceText newText, ImmutableArray<TextChange> changes)
ConvertTupleToStruct\IRemoteConvertTupleToStructCodeRefactoringService.cs (2)
26ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> documentTextChanges, 30public readonly ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> DocumentTextChanges = documentTextChanges;
Copilot\CopilotChangeAnalysisUtilities.cs (2)
37/// passed to <see cref="SourceText.WithChanges(IEnumerable{TextChange})"/> for the text snapshot corresponding to 44ImmutableArray<TextChange> textChanges,
Copilot\CopilotUtilities.cs (12)
20SourceText oldText, ImmutableArray<TextChange> changes) 34public static ImmutableArray<TextSpan> GetTextSpansFromTextChanges(IEnumerable<TextChange>? changes) 42foreach (var change in changes) 60public static ImmutableArray<TextChange> TryNormalizeCopilotTextChanges(IEnumerable<TextChange> textChanges) 62using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder); 63foreach (var textChange in textChanges) 72var lastEdit = builder[i - 1]; 73var currentEdit = builder[i]; 83public static void ThrowIfNotNormalized(ImmutableArray<TextChange> textChanges) 89var lastEdit = textChanges[i - 1]; 90var currentEdit = textChanges[i];
Copilot\ICopilotChangeAnalysisService.cs (3)
38Document document, ImmutableArray<TextChange> normalizedChanges, CancellationToken cancellationToken); 53ImmutableArray<TextChange> normalizedChanges, 81ImmutableArray<TextChange> normalizedChanges,
Copilot\IProposalAdjusterService.cs (21)
35[property: DataMember(Order = 0)] ImmutableArray<TextChange> TextChanges, 54ImmutableArray<TextChange> normalizedChanges, LineFormattingOptions? lineFormattingOptions, 63DocumentId documentId, ImmutableArray<TextChange> normalizedChanges, 89ImmutableArray<TextChange> normalizedChanges, LineFormattingOptions? lineFormattingOptions, 115ImmutableArray<TextChange> normalizedChanges, LineFormattingOptions? lineFormattingOptions, 181private static ImmutableArray<TextChange> FixLineEndingBoundaries( 182SourceText originalText, ImmutableArray<TextChange> changes) 187using var _ = ArrayBuilder<TextChange>.GetInstance(out var result); 190foreach (var change in changes) 247/// If the diff algorithm merged adjacent changes into a single <see cref="TextChange"/> that spans across the ATS boundary, 254internal static ImmutableArray<TextChange> ConstrainChangesToAvoidSpan( 255SourceText originalText, ImmutableArray<TextChange> changes, TextSpan protectedSpan) 260using var _ = ArrayBuilder<TextChange>.GetInstance(out var result); 263foreach (var change in changes) 293/// Splits or trims a <see cref="TextChange"/> that intersects the protected span. 300TextChange change, 302ArrayBuilder<TextChange> result) 453internal static ImmutableArray<TextChange> FixLineEndingBoundaries( 454SourceText originalText, ImmutableArray<TextChange> changes) 457internal static ImmutableArray<TextChange> ConstrainChangesToAvoidSpan( 458SourceText originalText, ImmutableArray<TextChange> changes, TextSpan protectedSpan)
Copilot\IRemoteCopilotChangeAnalysisService.cs (1)
18Checksum solutionChecksum, DocumentId documentId, ImmutableArray<TextChange> normalizedChanges, CancellationToken cancellationToken);
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
111var textChange = embeddedItem.Change.TextChange;
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (1)
98var textChange = change.TextChange;
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
124var result = await client.TryInvokeAsync<IRemoteEncapsulateFieldService, ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>>(
EncapsulateField\IRemoteEncapsulateFieldService.cs (1)
14ValueTask<ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>> EncapsulateFieldsAsync(
FullyQualify\AbstractFullyQualifyService.cs (1)
217private async Task<IEnumerable<TextChange>> ProcessNodeAsync(Document document, TSimpleNameSyntax simpleName, string containerName, INamespaceOrTypeSymbol originalSymbol, CancellationToken cancellationToken)
FullyQualify\IFullyQualifyService.cs (2)
25internal readonly struct FullyQualifyIndividualFixData(string title, ImmutableArray<TextChange> textChanges) 30public readonly ImmutableArray<TextChange> TextChanges = textChanges;
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
109TextChange? replacementTextChange = parameter.IsParams
InlineHints\InlineHint.cs (3)
18public readonly TextChange? ReplacementTextChange; 33TextChange? replacementTextChange, 42TextChange? replacementTextChange,
InlineHints\TypeHint.cs (3)
10internal readonly struct TypeHint(ITypeSymbol type, TextSpan span, TextChange? textChange, bool leadingSpace = false, bool trailingSpace = false) 16public TextChange? TextChange { get; } = textChange; 23public void Deconstruct(out ITypeSymbol type, out TextSpan span, out TextChange? textChange, out ImmutableArray<SymbolDisplayPart> prefix, out ImmutableArray<SymbolDisplayPart> suffix)
MapCode\IMapCodeService.cs (1)
30Task<ImmutableArray<TextChange>?> MapCodeAsync(
RawStringLiteral\IRawStringLiteralOnAutoInsertService.cs (1)
25TextChange? GetTextChangeForQuote(Document document, SourceText text, int caretPosition, CancellationToken cancellationToken);
SemanticSearch\IRemoteSemanticSearchService.cs (3)
29ValueTask OnDocumentUpdatedAsync(RemoteServiceCallbackId callbackId, DocumentId documentId, ImmutableArray<TextChange> changes, CancellationToken cancellationToken); 61public ValueTask OnDocumentUpdatedAsync(RemoteServiceCallbackId callbackId, DocumentId documentId, ImmutableArray<TextChange> changes, CancellationToken cancellationToken) 130public async ValueTask OnDocumentUpdatedAsync(DocumentId documentId, ImmutableArray<TextChange> changes, CancellationToken cancellationToken)
SemanticSearch\ISemanticSearchResultsObserver.cs (1)
25ValueTask OnDocumentUpdatedAsync(DocumentId documentId, ImmutableArray<TextChange> changes, CancellationToken cancellationToken);
Snippets\RoslynLSPSnippetConverter.cs (7)
22public static async Task<string> GenerateLSPSnippetAsync(Document document, int caretPosition, ImmutableArray<SnippetPlaceholder> placeholders, TextChange textChange, int triggerLocation, CancellationToken cancellationToken) 24var extendedTextChange = await ExtendSnippetTextChangeAsync(document, textChange, placeholders, caretPosition, triggerLocation, cancellationToken).ConfigureAwait(false); 32private static string ConvertToLSPSnippetString(TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition) 108private static async Task<TextChange> ExtendSnippetTextChangeAsync(Document document, TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition, int triggerLocation, CancellationToken cancellationToken) 113var newTextChange = new TextChange(extendedSpan, newString); 123private static TextSpan GetUpdatedTextSpan(TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition, int triggerLocation)
Snippets\SnippetChange.cs (2)
19public readonly ImmutableArray<TextChange> TextChanges; 33ImmutableArray<TextChange> textChanges,
Snippets\SnippetFunctionService.cs (1)
44var textChange = new TextChange(fieldSpan, fullyQualifiedTypeName);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (2)
39protected sealed override async Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken) 55var change = new TextChange(TextSpan.FromBounds(position, position), resultingNode.ToFullString());
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (1)
57protected sealed override async Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractLockSnippetProvider.cs (1)
15protected sealed override Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractMainMethodSnippetProvider.cs (1)
22protected sealed override Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractPropertySnippetProvider.cs (1)
21protected sealed override async Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractSingleChangeSnippetProvider.cs (3)
15protected abstract Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken); 17protected sealed override async Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken) 19var change = await GenerateSnippetTextChangeAsync(document, position, cancellationToken).ConfigureAwait(false);
Snippets\SnippetProviders\AbstractSnippetProvider.cs (2)
41protected abstract Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken); 191private static async Task<Document> GetDocumentWithSnippetAsync(Document document, ImmutableArray<TextChange> snippets, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (3)
28protected abstract Task<TextChange?> GetAccessibilityModifiersChangeAsync(Document document, int position, CancellationToken cancellationToken); 30protected sealed override async Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync( 35var mainChange = new TextChange(TextSpan.FromBounds(position, position), typeDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractUsingSnippetProvider.cs (1)
17protected sealed override async Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
59foreach (var formattingChange in formattingChanges) 61var change = formattingChange;
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (6)
316Action<SourceText, ArrayBuilder<TextChange>, int, int, int, int> addEdits, 321using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 329SourceText text, ArrayBuilder<TextChange> edits, 342SourceText text, ArrayBuilder<TextChange> edits, 355SourceText text, ArrayBuilder<TextChange> edits, 412using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits);
Microsoft.CodeAnalysis.Razor.Compiler (1)
CSharp\TextChangeExtensions.cs (1)
11public static SourceChange AsSourceChange(this TextChange textChange)
Microsoft.CodeAnalysis.ResxSourceGenerator (31)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (6)
23private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 38_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 60public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 66private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 80private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 89var result = new List<TextChange>(count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (7)
20private readonly CancellableLazy<IList<TextChange>> _lazyChanges; 37_lazyChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 48public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 54private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 60var result = new List<TextChange>(); 76private void AddTextChanges(List<TextChange> list, SyntaxToken token1, SyntaxToken token2, TriviaData data) 81foreach (var change in data.GetTextChanges(span))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (10)
189protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 265public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 267using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 674private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 702var change = GetWhitespaceTextChange( 712private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 719var change = changes[i]; 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.VisualBasic (1)
Syntax\VisualBasicSyntaxTree.vb (1)
535Public Overrides Function GetChanges(oldTree As SyntaxTree) As IList(Of TextChange)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (8)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (2)
15Private ReadOnly _textChanges As IList(Of TextChange) 58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
176changes As ArrayBuilder(Of TextChange), 232changes As ArrayBuilder(Of TextChange),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
35Public Function FormatToken(token As SyntaxToken, cancellationToken As CancellationToken) As IList(Of TextChange) Implements ISmartTokenFormatter.FormatToken
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Formatting\VisualBasicSyntaxFormattingService.vb (2)
28Public Function GetFormattingChangesOnTypedCharacter(document As ParsedDocument, caretPosition As Integer, indentationOptions As IndentationOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnTypedCharacter 32Public Function GetFormattingChangesOnPaste(document As ParsedDocument, textSpan As TextSpan, options As SyntaxFormattingOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnPaste
Microsoft.CodeAnalysis.VisualBasic.Features (6)
Completion\CompletionProviders\AwaitCompletionProvider.vb (2)
46Protected Overrides Function GetReturnTypeChangeAsync(solution As Solution, semanticModel As SemanticModel, declaration As SyntaxNode, cancellationToken As CancellationToken) As Task(Of TextChange?) 48Return SpecializedTasks.Default(Of TextChange?)
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (3)
197Protected Overrides Function GetTextChangeAsync(selectedItem As CompletionItem, ch As Char?, cancellationToken As CancellationToken) As Task(Of TextChange?) 200Dim change As TextChange 209Return Task.FromResult(Of TextChange?)(change)
Completion\CompletionProviders\PartialTypeCompletionProvider.vb (1)
72Public Overrides Async Function GetTextChangeAsync(document As Document, selectedItem As CompletionItem, ch As Char?, cancellationToken As CancellationToken) As Task(Of TextChange?)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (10)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (2)
15Private ReadOnly _textChanges As IList(Of TextChange) 58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
176changes As ArrayBuilder(Of TextChange), 232changes As ArrayBuilder(Of TextChange),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
35Public Function FormatToken(token As SyntaxToken, cancellationToken As CancellationToken) As IList(Of TextChange) Implements ISmartTokenFormatter.FormatToken
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Formatting\VisualBasicSyntaxFormattingService.vb (2)
28Public Function GetFormattingChangesOnTypedCharacter(document As ParsedDocument, caretPosition As Integer, indentationOptions As IndentationOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnTypedCharacter 32Public Function GetFormattingChangesOnPaste(document As ParsedDocument, textSpan As TextSpan, options As SyntaxFormattingOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnPaste
Microsoft.CodeAnalysis.Workspaces (125)
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (29)
22private readonly struct IntervalIntrospector : IIntervalIntrospector<TextChange> 24public TextSpan GetSpan(TextChange value) 31private readonly SimpleMutableIntervalTree<TextChange, IntervalIntrospector> _totalChangesIntervalTree = 32SimpleMutableIntervalTree.Create(new IntervalIntrospector(), Array.Empty<TextChange>()); 54foreach (var change in currentChanges) 82SimpleMutableIntervalTree<TextChange, IntervalIntrospector> cumulativeChanges, 83ImmutableArray<TextChange> currentChanges) 85using var overlappingSpans = TemporaryArray<TextChange>.Empty; 86using var intersectingSpans = TemporaryArray<TextChange>.Empty; 95SimpleMutableIntervalTree<TextChange, IntervalIntrospector> cumulativeChanges, 96ImmutableArray<TextChange> currentChanges, 97ref TemporaryArray<TextChange> overlappingSpans, 98ref TemporaryArray<TextChange> intersectingSpans) 100foreach (var change in currentChanges) 125TextChange change, 126in TemporaryArray<TextChange> overlappingSpans, 127in TemporaryArray<TextChange> intersectingSpans) 148private static bool IsPureInsertion(TextChange change) 152TextChange change, 153in TemporaryArray<TextChange> overlappingSpans, 154in TemporaryArray<TextChange> intersectingSpans) 181var otherChange = intersectingSpans[0]; 199TextChange change, 200in TemporaryArray<TextChange> overlappingSpans, 201in TemporaryArray<TextChange> intersectingSpans) 210TextChange change, 211in TemporaryArray<TextChange> overlappingSpans) 230TextChange change, 231in TemporaryArray<TextChange> intersectingSpans)
Formatting\Formatter.cs (9)
267public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 270internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken) 282public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 285internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 297public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 300internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 303private static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 307? SpecializedCollections.EmptyList<TextChange>() 311internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken = default)
Formatting\Rules\DefaultFormattingRuleFactoryServiceFactory.cs (2)
31public IEnumerable<TextChange> FilterFormattedChanges(DocumentId document, TextSpan span, IList<TextChange> changes)
Formatting\Rules\IHostDependentFormattingRuleFactoryService.cs (2)
16IEnumerable<TextChange> FilterFormattedChanges(DocumentId documentId, TextSpan span, IList<TextChange> changes);
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (10)
16public static ImmutableArray<TextChange> CreateEdits(SourceText originalSourceText, ArrayBuilder<UnmergedDocumentChanges> unmergedChanges) 18using var _ = ArrayBuilder<TextChange>.GetInstance(out var commentChanges); 31private static List<List<TextChange>> PartitionChangesForDocument(IEnumerable<TextChange> changes, SourceText originalSourceText) 33var partitionedChanges = new List<List<TextChange>>(); 34var currentPartition = new List<TextChange> 40foreach (var change in changes.Skip(1)) 62private static ImmutableArray<TextChange> GetCommentChangesForDocument(IEnumerable<IEnumerable<TextChange>> partitionedChanges, string projectName, SourceText oldDocumentText) 64using var _ = ArrayBuilder<TextChange>.GetInstance(out var commentChanges);
LinkedFileDiffMerging\DefaultDocumentTextDifferencingService.cs (2)
24public Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken) 27public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken)
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (16)
135private static async Task<ImmutableArray<TextChange>> AddDocumentMergeChangesAsync( 138ImmutableArray<TextChange> cumulativeChanges, 143using var _1 = ArrayBuilder<TextChange>.GetInstance(out var unmergedDocumentChanges); 144using var _2 = ArrayBuilder<TextChange>.GetInstance(out var successfullyMergedChanges); 150foreach (var change in textChanges) 161var cumulativeChange = cumulativeChanges[cumulativeChangeIndex]; 208private static (ImmutableArray<TextChange> mergeChanges, ImmutableArray<TextSpan> mergeConflictResolutionSpans) MergeChangesWithMergeFailComments( 209ImmutableArray<TextChange> mergedChanges, 210ImmutableArray<TextChange> commentChanges) 215using var _1 = ArrayBuilder<TextChange>.GetInstance(out var combinedChanges); 222foreach (var mergedChange in mergedChangesList) 270private static ImmutableArray<TextChange> NormalizeChanges(ImmutableArray<TextChange> changes) 276using var _ = ArrayBuilder<TextChange>.GetInstance(changes.Length, out var normalizedChanges); 278var currentChange = changes[0]; 279foreach (var nextChange in changes.AsSpan()[1..])
LinkedFileDiffMerging\UnmergedDocumentChanges.cs (2)
10internal readonly struct UnmergedDocumentChanges(ImmutableArray<TextChange> unmergedChanges, string projectName, DocumentId documentId) 12public readonly ImmutableArray<TextChange> UnmergedChanges = unmergedChanges;
Remote\RemoteUtilities.cs (3)
24public static async ValueTask<ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>> GetDocumentTextChangesAsync( 29using var _ = ArrayBuilder<(DocumentId, ImmutableArray<TextChange>)>.GetInstance(out var builder); 60ImmutableArray<(DocumentId documentId, ImmutableArray<TextChange> textChanges)> documentTextChanges,
Rename\IRemoteRenamerService.cs (2)
212ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> documentTextChanges, 230public readonly ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> DocumentTextChanges = documentTextChanges;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (6)
23private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 38_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 60public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 66private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 80private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 89var result = new List<TextChange>(count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (7)
20private readonly CancellableLazy<IList<TextChange>> _lazyChanges; 37_lazyChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 48public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 54private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 60var result = new List<TextChange>(); 76private void AddTextChanges(List<TextChange> list, SyntaxToken token1, SyntaxToken token2, TriviaData data) 81foreach (var change in data.GetTextChanges(span))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (10)
189protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 265public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 267using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 674private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 702var change = GetWhitespaceTextChange( 712private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 719var change = changes[i]; 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (2)
16ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter(ParsedDocument document, int caretPosition, IndentationOptions indentationOptions, CancellationToken cancellationToken); 17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (3)
59public ParsedDocument WithChange(TextChange change, CancellationToken cancellationToken) 62public ParsedDocument WithChanges(IEnumerable<TextChange> changes, CancellationToken cancellationToken) 68public IEnumerable<TextChange> GetChanges(in ParsedDocument oldDocument)
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (5)
18public abstract Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync( 28protected static ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)> MatchMappedSpansToTextChanges( 29ImmutableArray<TextChange> textChanges, 34using var _ = ArrayBuilder<(string, TextChange)>.GetInstance(out var mappedFilePathAndTextChange); 41var newTextChange = new TextChange(mappedSpanResults[i].Span, newText);
Workspace\Host\DocumentService\ISourceGeneratedDocumentSpanMappingService.cs (1)
21internal record struct MappedTextChange(string MappedFilePath, TextChange TextChange);
Workspace\Host\DocumentService\ISpanMappingService.cs (1)
29Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync(
Workspace\Solution\Document.cs (3)
441public async Task<IEnumerable<TextChange>> GetTextChangesAsync(Document oldDocument, CancellationToken cancellationToken = default) 450internal ImmutableArray<TextChange> GetTextChangesSynchronously( 458private async Task<ImmutableArray<TextChange>> GetTextChangesAsync(
Workspace\Solution\IDocumentTextDifferencingService.cs (2)
22Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken); 32Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken);
Roslyn.Diagnostics.Analyzers (36)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (6)
23private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 38_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 60public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 66private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 80private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 89var result = new List<TextChange>(count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (7)
20private readonly CancellableLazy<IList<TextChange>> _lazyChanges; 37_lazyChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 48public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 54private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 60var result = new List<TextChange>(); 76private void AddTextChanges(List<TextChange> list, SyntaxToken token1, SyntaxToken token2, TriviaData data) 81foreach (var change in data.GetTextChanges(span))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (10)
189protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 265public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 267using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 674private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 702var change = GetWhitespaceTextChange( 712private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 719var change = changes[i]; 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (2)
16ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter(ParsedDocument document, int caretPosition, IndentationOptions indentationOptions, CancellationToken cancellationToken); 17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (3)
59public ParsedDocument WithChange(TextChange change, CancellationToken cancellationToken) 62public ParsedDocument WithChanges(IEnumerable<TextChange> changes, CancellationToken cancellationToken) 68public IEnumerable<TextChange> GetChanges(in ParsedDocument oldDocument)
Roslyn.Diagnostics.CSharp.Analyzers (12)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
270LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken) 361LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (2)
18private readonly IList<TextChange> _textChanges; 57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
44public IList<TextChange> FormatRange( 76public IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (4)
73public ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter( 185private static IList<TextChange> FormatToken( 192private static ImmutableArray<TextChange> FormatRange( 337public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken)
Roslyn.Diagnostics.VisualBasic.Analyzers (10)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (2)
15Private ReadOnly _textChanges As IList(Of TextChange) 58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
176changes As ArrayBuilder(Of TextChange), 232changes As ArrayBuilder(Of TextChange),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
35Public Function FormatToken(token As SyntaxToken, cancellationToken As CancellationToken) As IList(Of TextChange) Implements ISmartTokenFormatter.FormatToken
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Formatting\VisualBasicSyntaxFormattingService.vb (2)
28Public Function GetFormattingChangesOnTypedCharacter(document As ParsedDocument, caretPosition As Integer, indentationOptions As IndentationOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnTypedCharacter 32Public Function GetFormattingChangesOnPaste(document As ParsedDocument, textSpan As TextSpan, options As SyntaxFormattingOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnPaste