186 instantiations of TextChange
dotnet (3)
dotnet-format (3)
GenerateDocumentationAndConfigFiles (4)
Microsoft.AspNetCore.App.Analyzers (4)
Microsoft.CodeAnalysis (4)
Microsoft.CodeAnalysis.Analyzers (6)
Microsoft.CodeAnalysis.AnalyzerUtilities (4)
Microsoft.CodeAnalysis.CodeStyle (6)
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)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
Microsoft.CodeAnalysis.CSharp.Features (37)
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);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Microsoft.CodeAnalysis.Features (63)
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.ResxSourceGenerator (4)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
Microsoft.CodeAnalysis.VisualBasic.Features (6)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
Microsoft.CodeAnalysis.Workspaces (9)
Roslyn.Diagnostics.Analyzers (4)
Roslyn.Diagnostics.CSharp.Analyzers (2)
Roslyn.Diagnostics.VisualBasic.Analyzers (3)
675 references to TextChange
dotnet (2)
dotnet-format (7)
GenerateDocumentationAndConfigFiles (36)
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)
Microsoft.AspNetCore.App.Analyzers (2)
Microsoft.CodeAnalysis (29)
Microsoft.CodeAnalysis.Analyzers (38)
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)
Microsoft.CodeAnalysis.AnalyzerUtilities (31)
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)
Microsoft.CodeAnalysis.CodeStyle (33)
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)
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);
Microsoft.CodeAnalysis.CSharp (1)
Microsoft.CodeAnalysis.CSharp.CodeStyle (8)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
Microsoft.CodeAnalysis.CSharp.Features (38)
Microsoft.CodeAnalysis.CSharp.Workspaces (12)
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (1)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (2)
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)
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)
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)
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)
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)
Microsoft.CodeAnalysis.ResxSourceGenerator (31)
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)
Microsoft.CodeAnalysis.VisualBasic (1)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (8)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
Microsoft.CodeAnalysis.VisualBasic.Features (6)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (10)
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)
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)
Roslyn.Diagnostics.Analyzers (36)
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)
Roslyn.Diagnostics.CSharp.Analyzers (12)
Roslyn.Diagnostics.VisualBasic.Analyzers (10)