571 instantiations of TextChange
GenerateDocumentationAndConfigFiles (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
IdeCoreBenchmarks (5)
IncrementalSourceGeneratorBenchmarks.cs (1)
161var changedText = sourceText.WithChanges(new TextChange(sourceText.Lines[0].Span, $"// added text{i}"));
SyntacticChangeRangeBenchmark.cs (4)
54var newText = _text.WithChanges(new TextChange(new TextSpan(_index + 8, 1), "m")); 63var newText = _text.WithChanges(new TextChange(new TextSpan(_index, 0), "var v = x ")); 72var newText = _text.WithChanges(new TextChange(new TextSpan(0, addedText.Length), addedText)); 81var newText = _text.WithChanges(new TextChange(new TextSpan(_text.Length - addedText.Length, addedText.Length), addedText));
Metrics (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Metrics.Legacy (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
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)
861return this.WithChanges(new TextChange(span, newText)); 922textChanges.Add(new TextChange(range.Span, newt));
Microsoft.CodeAnalysis.Analyzers (6)
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (1)
174var textChange = new TextChange(fixInfo.AdditionalDocumentSpanToFix.Value, fixInfo.FixValue);
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs (1)
139textChanges.Add(new TextChange(inputSpanToFix, fixInfo.FixValue));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.BannedApiAnalyzers (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
268changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 378changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
174return new TextChange( 235return new TextChange(new TextSpan(textLine.Start, 0), newText: indentation);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
92edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 93edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
94edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 95edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.EditorFeatures (17)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
650var insertChange = new TextChange(new TextSpan(insertionPosition, 0), bracePair);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
262var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (3)
125return new TextChange(new TextSpan(position + 1, 0), "\"\"\""); 182return new TextChange(new TextSpan(position + 1, 0), "\""); 239return new TextChange(new TextSpan(token.GetRequiredParent().Span.End, 0), "\"");
StringCopyPaste\KnownSourcePasteProcessor.cs (7)
188edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 192edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 197edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace)); 213edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace)); 217edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 237edits.Add(new TextChange(new TextSpan(interpolation.OpenBraceToken.Span.End, 0), new string('{', dollarSignsToAdd))); 238edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd)));
StringCopyPaste\UnknownSourcePasteProcessor.cs (5)
125edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 129edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 140edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 169edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace)); 213edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
StringIndentation\StringIndentationTests.cs (1)
57changes.Add(new TextChange(new TextSpan(lineStart + offset - 1, 1), "|"));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenTupleTest.cs (1)
22617var newText = text.WithChanges(new TextChange(new TextSpan(pos, 0), " ")); // add space before closing-paren
Microsoft.CodeAnalysis.CSharp.Features (27)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
129newLineEdit = new TextChange(new TextSpan(annotatedNewline.SpanStart, 0), annotatedNewline.ToString());
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\CrefCompletionProvider.cs (1)
382return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
282return 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 (4)
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), ""));
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (1)
88return new TextChange(selectedItem.Span, insertionText);
Completion\CompletionProviders\TupleNameCompletionProvider.cs (1)
118return Task.FromResult<TextChange?>(new TextChange(
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);
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
79return 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);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
174return new TextChange( 235return new TextChange(new TextSpan(textLine.Start, 0), newText: indentation);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
92edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 93edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
94edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 95edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\BindingAwaitTests.cs (1)
29TextChange change = new TextChange(span, "/*comment*/");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Symbols\Metadata\MetadataTypeTests.cs (2)
365var change = new TextChange(span, text1); 380change = new TextChange(span, text2);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (50)
IncrementalParsing\IncrementalParsingTests.cs (48)
496var change = new TextChange(span, "."); 528var change = new TextChange(span, " "); 574text = text.WithChanges(new TextChange(prefixSpan, ""), new TextChange(suffixSpan, "")); 626var withOpenBraceDeletedText = initialText.WithChanges(new TextChange(openBraceLine.SpanIncludingLineBreak, "")); 837var withCloseBraceDeletedText = withOpenBraceDeletedText.WithChanges(new TextChange(closeBraceLine.SpanIncludingLineBreak, "")); 1395var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 1409var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 3178new TextChange(new TextSpan(str.IndexOf(" abc", StringComparison.Ordinal), 0), "//"), 3179new TextChange(new TextSpan(str.IndexOf(" 123", StringComparison.Ordinal), 0), "//"), 3180new TextChange(new TextSpan(str.IndexOf(" def", StringComparison.Ordinal), 0), "//")); 3200var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), "{")); 3216var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"System.Console.WriteLine(false) 3275var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"if (false) 3331var change = new TextChange(span, text1); 3345change = new TextChange(span, text2); 3414var change = new TextChange(span, "// "); 3451var change = new TextChange(span, "// "); 3530var change = new TextChange(new TextSpan(0, 0), items[1]); // Prepend 3629var change = new TextChange(span, "p"); 3650var change = new TextChange(span, ""); 3671var change = new TextChange(span, "["); 3692var change = new TextChange(span, "[Obsolete]"); 3713var change = new TextChange(span, "public"); 3735var change = new TextChange(span, "c"); 3759var change = new TextChange(span, "1, Attr2"); 3783var change = new TextChange(span, ", Attr2"); 3807var change = new TextChange(span, " [Attr2]"); 3831var change = new TextChange(span, "Arg"); 3855var change = new TextChange(span, "2"); 3881var change = new TextChange(span, "1, Attr2"); 3906var change = new TextChange(span, "[Attr]"); 3932var change = new TextChange(span, " [Attr2]"); 3958var change = new TextChange(span, ""); 3976var change = new TextChange(span, ".z"); 3994var change = new TextChange(span, " if (c) { }"); 4012var change = new TextChange(span, " else (c) { }"); 4026var change = new TextChange(span, ""); 4040var change = new TextChange(span, "{ "); 4055var change = new TextChange(span, ""); 4092var change = new TextChange(span, "["); 4118new TextChange(new TextSpan(position1, 0), "n"), 4119new TextChange(new TextSpan(position2, 0), "n"), 4120new TextChange(new TextSpan(position3, 0), "n")); 4158new TextChange(new TextSpan(locationOfChange, 0), "/*"), 4159new TextChange(new TextSpan(locationOfChange + widthOfChange, 0), "*/") 4168var newText = oldText.WithChanges(new TextChange(new TextSpan(locationOfChange, widthOfChange), "")); 4194var newText = oldText.WithChanges(new TextChange(new TextSpan(oldText.Length, 0), newChar.ToString()));
Syntax\SyntaxNodeTests.cs (2)
909var tree2 = tree1.WithChangedText(tree1.GetText().WithChanges(new TextChange(default, " "))); 920var tree2 = tree1.WithChangedText(tree1.GetText().WithChanges(new TextChange(new TextSpan(22, 0), " return; ")));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
SyntaxTreeExtensions.cs (1)
20var newFullText = oldFullText.WithChanges(new TextChange(new TextSpan(offset, length), newText));
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
268changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 378changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Microsoft.CodeAnalysis.EditorFeatures (13)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (1)
207var insertChange = new TextChange(new TextSpan(insertPosition, 0), endingString);
CommentSelection\AbstractCommentSelectionBase.cs (2)
80=> textChanges.Add(new TextChange(new TextSpan(position, 0), text)); 83=> textChanges.Add(new TextChange(span, string.Empty));
Copilot\CopilotWpfTextCreationListener.cs (1)
119textChanges.Add(new TextChange(edit.Span.Span.ToTextSpan(), edit.ReplacementText));
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (1)
100var textChange = new TextChange(span, newLine);
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (1)
58var textChange = new TextChange(span, newText);
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (5)
171var textChange = new TextChange(); 185textChange = new TextChange(curLine.Span, $"{untrimmedKey}= {optionValue}{comment}"); 306return (editorConfigText.WithChanges(new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry)), lastValidHeaderSpanEnd, lastValidSpecificHeaderSpanEnd); 315return (editorConfigText.WithChanges(new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry)), lastValidHeaderSpanEnd, lastValidSpecificHeaderSpanEnd); 349var result = editorConfigText.WithChanges(new TextChange(new TextSpan(editorConfigText.Length, 0), prefix + newEntry));
IntelliSense\AsyncCompletion\CompletionSource.cs (1)
195buffer.ApplyChange(new TextChange(TextSpan.FromBounds(caretPoint - 2, caretPoint), string.Empty));
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
187var textChange = new TextChange(new TextSpan(_snapshotSpan.Start, _snapshotSpan.Length), _stateMachine.TrackingSession.OriginalName);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Completion\AbstractCompletionProviderTests.cs (2)
761textChange = new TextChange(textChange.Span, textChange.NewText.TrimEnd(commitChar) + commitChar); 769var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString());
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (85)
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (81)
87CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, supportBlockComments: true); 103new TextChange(new TextSpan(8, 0), "/*"), 104new TextChange(new TextSpan(14, 0), "*/"), 117new TextChange(new TextSpan(0, 0), "//"), 118new TextChange(new TextSpan(16, 0), "//"), 127CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, supportBlockComments: false); 145new TextChange(new TextSpan(20, 0), "//"), 146new TextChange(new TextSpan(34, 0), "//"), 147new TextChange(new TextSpan(41, 0), "//"), 171new TextChange(new TextSpan(0, 0), "//"), 172new TextChange(new TextSpan(9, 0), "//"), 173new TextChange(new TextSpan(12, 0), "//"), 174new TextChange(new TextSpan(30, 0), "//"), 185new TextChange(new TextSpan(0, 0), "//"), 186new TextChange(new TextSpan(11, 0), "//"), 187new TextChange(new TextSpan(16, 0), "//"), 188new TextChange(new TextSpan(36, 0), "//"), 211new TextChange(new TextSpan(20, 0), "//"), 212new TextChange(new TextSpan(34, 0), "//"), 213new TextChange(new TextSpan(41, 0), "//"), 232new TextChange(new TextSpan(20, 0), "//"), 233new TextChange(new TextSpan(34, 0), "//"), 234new TextChange(new TextSpan(41, 0), "//"), 254new TextChange(new TextSpan(20, 0), "//"), 255new TextChange(new TextSpan(34, 0), "//"), 256new TextChange(new TextSpan(41, 0), "//"), 277new TextChange(new TextSpan(20, 0), "/*"), 278new TextChange(new TextSpan(21, 0), "*/"), 279new TextChange(new TextSpan(34, 0), "//"), 280new TextChange(new TextSpan(41, 0), "/*"), 281new TextChange(new TextSpan(42, 0), "*/"), 282new TextChange(new TextSpan(52, 0), "//"), 302new TextChange(new TextSpan(20, 0), "//"), 303new TextChange(new TextSpan(34, 0), "//"), 304new TextChange(new TextSpan(41, 0), "//"), 313UncommentSelection(code, new[] { new TextChange(new TextSpan(0, 2), string.Empty) }, Span.FromBounds(0, 6), supportBlockComments: true); 322new TextChange(new TextSpan(7, 2), string.Empty), 323new TextChange(new TextSpan(30, 2), string.Empty), 335new TextChange(new TextSpan(11, 2), string.Empty), 336new TextChange(new TextSpan(34, 2), string.Empty), 359new TextChange(new TextSpan(18, 2), string.Empty), 360new TextChange(new TextSpan(34, 2), string.Empty), 361new TextChange(new TextSpan(47, 2), string.Empty), 362new TextChange(new TextSpan(68, 2), string.Empty), 363new TextChange(new TextSpan(119, 2), string.Empty), 364new TextChange(new TextSpan(128, 2), string.Empty), 385new TextChange(new TextSpan(20, 2), string.Empty), 386new TextChange(new TextSpan(23, 2), string.Empty), 387new TextChange(new TextSpan(38, 2), string.Empty), 388new TextChange(new TextSpan(49, 2), string.Empty), 389new TextChange(new TextSpan(52, 2), string.Empty), 390new TextChange(new TextSpan(64, 2), string.Empty), 411new TextChange(new TextSpan(2, 2), string.Empty), 412new TextChange(new TextSpan(19, 2), string.Empty), 413new TextChange(new TextSpan(26, 2), string.Empty), 423CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, new[] { new Span(0, 15) }, supportBlockComments: true); 433new TextChange(new TextSpan(6, 2), string.Empty), 434new TextChange(new TextSpan(16, 2), string.Empty) 447new TextChange(new TextSpan(19, 2), string.Empty), 448new TextChange(new TextSpan(29, 2), string.Empty) 461new TextChange(new TextSpan(0, 2), string.Empty), 462new TextChange(new TextSpan(15, 2), string.Empty) 475new TextChange(new TextSpan(0, 2), string.Empty), 476new TextChange(new TextSpan(15, 2), string.Empty) 513new TextChange(new TextSpan(18, 2), string.Empty), 514new TextChange(new TextSpan(112, 2), string.Empty), 544new TextChange(new TextSpan(20, 2), string.Empty), 545new TextChange(new TextSpan(114, 2), string.Empty), 573new TextChange(new TextSpan(18, 2), string.Empty), 574new TextChange(new TextSpan(112, 2), string.Empty), 602new TextChange(new TextSpan(18, 2), string.Empty), 603new TextChange(new TextSpan(112, 2), string.Empty), 631new TextChange(new TextSpan(55, 2), string.Empty), 659new TextChange(new TextSpan(55, 2), string.Empty), 687new TextChange(new TextSpan(18, 2), string.Empty), 688new TextChange(new TextSpan(28, 2), string.Empty), 689new TextChange(new TextSpan(44, 2), string.Empty), 690new TextChange(new TextSpan(53, 2), string.Empty), 691new TextChange(new TextSpan(78, 2), string.Empty), 692new TextChange(new TextSpan(109, 2), string.Empty), 693new TextChange(new TextSpan(118, 2), string.Empty),
Completion\CompletionServiceTests.cs (1)
126return Task.FromResult(CompletionChange.Create(new TextChange(item.Span, nameof(DebugAssertTestCompletionProvider))));
Snippets\RoslynLSPSnippetConvertTests.cs (3)
404[], new TextChange(new TextSpan(8, 0), "quux"), triggerLocation: 12, CancellationToken.None).Result; 415[], new TextChange(new TextSpan(4, 4), "bar quux"), triggerLocation: 12, CancellationToken.None).Result; 492var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length));
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
IntelliSense\CSharpCompletionCommandHandlerTests.vb (2)
8239New TextChange(New TextSpan(0, _caretPosition), newText)) 8281Return Task.FromResult(CompletionChange.Create(New TextChange(item.Span, commitText)))
Microsoft.CodeAnalysis.Features (48)
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)
79=> Task.FromResult(CompletionChange.Create(new TextChange(item.Span, item.DisplayText)));
Completion\CompletionService.cs (2)
259return CompletionChange.Create(new TextChange(new TextSpan(), "")); 267return CompletionChange.Create(new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractAwaitCompletionProvider.cs (3)
208builder.Add(new TextChange(item.Span, _awaitKeyword)); 220builder.Add(new TextChange(new TextSpan(expr.SpanStart, 0), _awaitKeyword + " ")); 227builder.Add(new TextChange(TextSpan.FromBounds(dotToken.Value.SpanStart, item.Span.End), replacementText));
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
305new TextChange(replacementSpan, replacementText),
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
280var textChange = new TextChange(item.Span, assemblyName);
Completion\Providers\AbstractKeywordCompletionProvider.cs (1)
74=> Task.FromResult((TextChange?)new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (1)
116return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
470=> Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, GetInsertionText(selectedItem, ch)));
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (2)
135return CompletionChange.Create(new TextChange(completionItem.Span, completionText)); 160builder.Add(new TextChange(completionItem.Span, insertText));
Completion\Utilities.cs (2)
22return new TextChange(new TextSpan(0, 0), ""); 42return new TextChange(totalOldSpan, newText.ToString(totalNewSpan));
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 (1)
456new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText),
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
113replacementTextChange = new TextChange(textSpan, inlineHintText);
Snippets\SnippetFunctionService.cs (1)
43var 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)
71return 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)
36return 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)
25var 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\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\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.LanguageServer.Protocol (7)
Extensions\ProtocolConversions.cs (2)
353=> new TextChange(RangeToTextSpan(edit.Range, oldText), edit.NewText); 356=> new TextChange(RangeToTextSpan(changeEvent.Range, text), changeEvent.Text);
Handler\Completion\CompletionResultFactory.cs (1)
562return CompletionChange.Create(new TextChange(completionItem.Span, completionItem.DisplayText));
Handler\InlineCompletions\InlineCompletionsHandler.cs (4)
186var textChange = new TextChange(snippetShortcut, snippetFullText); 217lspTextChanges.Add(new TextChange(fieldInSnippetContext, lspTextForField)); 226lspTextChanges.Add(new TextChange(caretInSnippetContext, "$0")); 261originalSourceText.WithChanges(new TextChange(snippetSpan, parsedSnippet.DefaultText)));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (5)
Completion\CompletionResolveTests.cs (1)
502var textChange = new TextChange(span: new TextSpan(start: 77, length: 9), newText: @"public override void M()
Diagnostics\PullDiagnosticTests.cs (4)
1639var newCsProj2Document = csproj2Document.WithText(csproj2DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj2DocumentText), "B"))); 1727var newCsProj3Document = csproj3Document.WithText(csproj3DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj3DocumentText), "C"))); 1797var newCsProj2Document = csproj2Document.WithText(csproj2DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj2DocumentText), "B"))); 2232text = text.WithChanges(new TextChange(new TextSpan(position.Value, 0), textToInsert));
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.PublicApiAnalyzers (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (1)
NullableEnablePublicApiFix.cs (1)
67SourceText newSourceText = sourceText.WithChanges(new TextChange(new TextSpan(0, 0), extraLine));
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.UnitTests (156)
Text\SourceTextTests.cs (1)
192var change = new TextChange(span, text.ToString(span));
Text\TextChangeTests.cs (155)
111new TextChange(new TextSpan(0, 5), "Halo"), 112new TextChange(new TextSpan(6, 5), "Universe")); 123new TextChange(new TextSpan(0, 5), "Halo"), 124new TextChange(new TextSpan(3, 5), "Universe") 136new TextChange(new TextSpan(6, 5), "Universe"), 137new TextChange(new TextSpan(0, 5), "Halo") 150new TextChange(new TextSpan(6, 7), "Universe"), 151new TextChange(new TextSpan(0, 5), "Halo") 165new TextChange(new TextSpan(6, 0), "Super "), 166new TextChange(new TextSpan(6, 0), "Spectacular ")); 177new TextChange(new TextSpan(6, 0), "Super "), 178new TextChange(new TextSpan(6, 2), "Vu")); 189new TextChange(new TextSpan(6, 2), "Vu"), 190new TextChange(new TextSpan(6, 0), "Super ") 203new TextChange(new TextSpan(4, 1), string.Empty), 204new TextChange(new TextSpan(5, 1), string.Empty)); 214new TextChange(new TextSpan(4, 1), string.Empty), 215new TextChange(new TextSpan(6, 5), "Universe")); 229new TextChange(new TextSpan(4, 1), string.Empty)); 239new TextChange(new TextSpan(6, 5), "Universe")); 256new TextChange(new TextSpan(0, 1), "[1]"), 257new TextChange(new TextSpan(1, 1), "[2]"), 258new TextChange(new TextSpan(5, 0), "[3]"), 259new TextChange(new TextSpan(25, 2), "[4]") 301new TextChange(new TextSpan(8, 2), "IN"), 302new TextChange(new TextSpan(15, 2), "IN")); 309new TextChange(new TextSpan(8, 2), new string('a', 10)), 310new TextChange(new TextSpan(15, 2), new string('a', 10))); 317new TextChange(new TextSpan(8, 2), "\r\n"), 318new TextChange(new TextSpan(15, 2), "\r\n")); 325new TextChange(new TextSpan(6, 0), "aa\r"), 326new TextChange(new TextSpan(11, 0), "aa\r")); 333new TextChange(new TextSpan(6, 0), "aa\n"), 334new TextChange(new TextSpan(11, 0), "aa\n")); 341new TextChange(new TextSpan(4, 4), "aaaaaa"), 342new TextChange(new TextSpan(15, 4), "aaaaaa")); 349new TextChange(new TextSpan(5, 0), "aaaaaa")); 356new TextChange(new TextSpan(5, 0), "\naaaaaa\r")); 363new TextChange(new TextSpan(21, 0), "Line4\r\n"), 364new TextChange(new TextSpan(21, 0), "Line5\r\n")); 659var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 670var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 671var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), string.Empty)); // this should not cause exception 680var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 681var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 3), "oo")); 695var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 696var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), "bb")); 701Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abba") }, changes); 709var change1 = original.WithChanges(new TextChange(new TextSpan(1, 1), "aaa")); 710var change2 = change1.WithChanges(new TextChange(new TextSpan(3, 0), "bb")); 715Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "aabba") }, changes); 723var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 724var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 1), "bb")); 729Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abb") }, changes); 736var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 737var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 14), "ar")); 750var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 751var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 6), " Bel")); 764var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 765var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 6), "wazy V")); 778var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 779var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 784Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bbaa") }, changes); 791var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 792var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 797Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bbaa") }, changes); 804var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 805var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 810Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bba") }, changes); 817var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 818var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 2), "bb")); 823Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bb") }, changes); 830var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 831var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 836Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "bb") }, changes); 844var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 845var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 850Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bba") }, changes); 858var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 859var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 870var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o ")); 871var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 884var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 885var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 900var change1 = original.WithChanges(new TextChange(new TextSpan(8, 0), "l")); 901var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 916var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), " World")); 918var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 934c => c.WithChanges(new TextChange(new TextSpan(4, 0), "o ")), 935c => c.WithChanges(new TextChange(new TextSpan(6, 0), "World"))); 977Assert.Equal("new TextChange(new TextSpan(0, 1), \"abc\")", new TextChange(new TextSpan(0, 1), "abc").GetDebuggerDisplay()); 978Assert.Equal("new TextChange(new TextSpan(0, 1), (NewLength = 10))", new TextChange(new TextSpan(0, 1), "0123456789").GetDebuggerDisplay()); 1002var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText); 1022var newChange = new TextChange(new TextSpan(i, length: random.Next(editedLength - i)), newText); 1070var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a")); 1071var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), "bb")); 1084var change1 = original.WithChanges(new TextChange(new TextSpan(0, 0), "aa"), new TextChange(new TextSpan(1, 1), "aa")); 1085var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "")); 1098var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 0), "a")); 1099var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(2, 0), "bb")); 1112var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa"), new TextChange(new TextSpan(3, 1), "aa")); 1113var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "bbb")); 1125var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 3), "a"), new TextChange(new TextSpan(5, 0), "aaa")); 1126var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(3, 1), "bb")); 1139var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aaaaa"), new TextChange(new TextSpan(3, 1), "aaaa"), new TextChange(new TextSpan(6, 1), "aaaaa")); 1140var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "b"), new TextChange(new TextSpan(2, 0), "b"), new TextChange(new TextSpan(3, 4), "bbbbb"), new TextChange(new TextSpan(9, 5), "bbbbb"), new TextChange(new TextSpan(15, 3), "")); 1153var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "a")); 1154var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "b")); 1167var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa")); 1168var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "b"), new TextChange(new TextSpan(1, 2), "b")); 1181var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a"), new TextChange(new TextSpan(3, 2), "a")); 1182var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 3), "bbb")); 1195var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 4), ""), new TextChange(new TextSpan(5, 1), "")); 1196var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 0), "")); 1209var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(3, 1), ""), new TextChange(new TextSpan(4, 0), ""), new TextChange(new TextSpan(4, 0), ""), new TextChange(new TextSpan(4, 0), "")); 1210var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 1), ""), new TextChange(new TextSpan(2, 0), "")); 1223var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(2, 1), "")); 1224var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), ""), new TextChange(new TextSpan(1, 1), "")); 1249new TextChange(new TextSpan(39, 0), " "), 1250new TextChange(new TextSpan(42, 0), " "), 1251new TextChange(new TextSpan(57, 0), " "), 1252new TextChange(new TextSpan(58, 0), "\r\n"), 1253new TextChange(new TextSpan(64, 2), " "), 1254new TextChange(new TextSpan(69, 0), " "), 1260new TextChange(new TextSpan(35, 4), string.Empty), 1261new TextChange(new TextSpan(46, 4), string.Empty), 1262new TextChange(new TextSpan(73, 4), string.Empty), 1263new TextChange(new TextSpan(88, 0), " "), 1264new TextChange(new TextSpan(90, 4), string.Empty), 1265new TextChange(new TextSpan(105, 4), string.Empty),
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
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.EditorFeatures (2)
EndConstructGeneration\SpitLinesResult.vb (1)
51subjectBuffer.ApplyChange(New TextChange(New TextSpan(caretPosition, 0), joinedLines))
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
342subjectBuffer.ApplyChange(New TextChange(New TextSpan(insertPosition, 0), endText))
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)
235change = New TextChange(symbolItem.Span, insertionText.Substring(0, insertionText.Length - s_colonEquals.Length)) 237change = New TextChange(selectedItem.Span, insertionText.Substring(0, insertionText.Length - (s_colonEquals.Length - 1))) 239change = New TextChange(symbolItem.Span, insertionText)
Completion\CompletionProviders\PartialTypeCompletionProvider.vb (1)
76Return New TextChange(selectedItem.Span, insertionText)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (14)
IncrementalParser\IncrementalParser.vb (14)
88text = text.WithChanges(New TextChange(span, text.ToString(span))) 109Dim newText = text.WithChanges(New TextChange(New TextSpan(text.Length, 0), _s.Substring(i, 1))) 126Dim newText = oldText.WithChanges(New TextChange(New TextSpan(pos, 0), "'")) 135Dim anotherText = newText.WithChanges(New TextChange(New TextSpan(pos, 1), "")) 702Dim newText = oldText.WithChanges(New TextChange(New TextSpan(22, 0), " Sub ")) 741Dim newText = oldText.WithChanges(New TextChange(New TextSpan(103, 0), " ")) 767Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, 0), " ")) 792Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, replace.Length), "{")) 827Dim newText = oldText.WithChanges(New TextChange(New TextSpan(pos, 0), "'")) 1121Dim change = New TextChange(span, "") 1158Dim change = New TextChange(span, code1) 1164change = New TextChange(span, "") 1521New TextChange(TextSpan.FromBounds(29, 45), "")) 1674Dim change = New TextChange(New TextSpan(position, 2), "71")
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (5)
ParserTestUtilities.vb (4)
256newText = oldText.WithChanges(New TextChange(node.changeSpan, node.changeText)) 258newText = oldText.WithChanges(New TextChange(New TextSpan(0, 0), node.changeText)) 260newText = oldText.WithChanges(New TextChange(node.changeSpan, "")) 262newText = oldText.WithChanges(New TextChange(node.changeSpan, node.changeText))
SyntaxTreeExtensions.vb (1)
12Dim newFullText = oldFullText.WithChanges(New TextChange(New TextSpan(offset, length), newText))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
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);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
GenerateFileForEachAdditionalFileWithContentsCommented.cs (1)
32var changes = sourceText.Lines.SelectAsArray(l => new TextChange(new TextSpan(l.Start, length: 0), "// "));
Microsoft.CodeAnalysis.Workspaces.UnitTests (7)
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
567var newText = existingText.WithChanges(new TextChange(new TextSpan(existingText.Length, length: 0), " With Change"));
SymbolKeyTests.cs (3)
874var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 921var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 1419var newTree = syntaxTree.WithChangedText(text.WithChanges(new TextChange(new TextSpan(0, text.Length), text.ToString().Replace(" ", " "))));
SyntaxPathTests.cs (3)
95var newText = text.WithChanges(new TextChange(new TextSpan(0, 0), "class C {}")); 109var newText = text.WithChanges(new TextChange(new TextSpan(0, text.Length), "")); 430var newFullText = oldFullText.WithChanges(new TextChange(new TextSpan(offset, length), newText));
Microsoft.VisualStudio.LanguageServices (4)
Venus\ContainedDocument.cs (4)
522textChange = new TextChange(spanInOriginalText, snippetInRightText); 547textChange = new TextChange( 568textChange = new TextChange( 585textChange = new TextChange(
Microsoft.VisualStudio.LanguageServices.UnitTests (3)
Completion\MockCompletionProvider.vb (1)
26Return Task.FromResult(Of TextChange?)(New TextChange(selectedItem.Span, "InsertionText"))
Preview\PreviewChangesTests.vb (2)
275Dim textChange1 = New TextChange(New TextSpan(19, 1), "N") 278Dim textChange2 = New TextChange(New TextSpan(47, 1), "Y")
Roslyn.Diagnostics.Analyzers (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
268changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 378changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Roslyn.Diagnostics.VisualBasic.Analyzers (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
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()))
Roslyn.VisualStudio.Next.UnitTests (3)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
51var newText = oldText.WithChanges([new TextChange(new TextSpan(0, 1), "abc")]);
Services\ServiceHubServicesTests.cs (2)
105var newText = oldText.WithChanges(new TextChange(TextSpan.FromBounds(0, 0), "/* test */")); 1613document, [new TextChange(new TextSpan(listIndex, 1), """
Test.Utilities (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Text.Analyzers (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
1091 references to TextChange
GenerateDocumentationAndConfigFiles (36)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
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\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)
Metrics (31)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Metrics.Legacy (31)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
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)
748public virtual SourceText WithChanges(IEnumerable<TextChange> changes) 766foreach (var change in changes) 846/// Changes do not have to be in sorted order. However, <see cref="WithChanges(IEnumerable{TextChange})"/> will 851public SourceText WithChanges(params TextChange[] changes) 853return this.WithChanges((IEnumerable<TextChange>)changes); 895/// Gets the set of <see cref="TextChange"/> that describe how the text changed 899public virtual IReadOnlyList<TextChange> GetTextChanges(SourceText oldText) 904var 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)
174var 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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
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\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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.BannedApiAnalyzers (36)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
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\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.CodeStyle (33)
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
59foreach (var formattingChange in formattingChanges) 61var change = formattingChange;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.CodeStyle.Fixes (11)
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
259LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken) 350LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
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 (8)
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\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
48using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 68ArrayBuilder<TextChange> edits)
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
48using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 69ArrayBuilder<TextChange> edits)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (32)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (2)
93protected override IList<TextChange> FormatBasedOnEndToken(ParsedDocument document, int position, SyntaxFormattingOptions options, CancellationToken cancellationToken) 650var insertChange = new TextChange(new TextSpan(insertionPosition, 0), bracePair);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
262var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
Formatting\CSharpFormattingInteractionService.cs (6)
76public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync( 91public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken) 99public Task<ImmutableArray<TextChange>> GetFormattingChangesOnReturnAsync(Document document, int caretPosition, CancellationToken cancellationToken) 100=> SpecializedTasks.EmptyImmutableArray<TextChange>(); 102public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, char typedChar, int position, CancellationToken cancellationToken) 113return SpecializedTasks.EmptyImmutableArray<TextChange>();
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (4)
57if (textChangeOpt is not TextChange textChange) 82private static TextChange? TryGenerateInitialEmptyRawString( 134private static TextChange? TryGrowInitialEmptyRawString( 190private static TextChange? TryGrowRawStringDelimiters(
StringCopyPaste\AbstractPasteProcessor.cs (1)
123public abstract ImmutableArray<TextChange> GetEdits();
StringCopyPaste\KnownSourcePasteProcessor.cs (8)
49public override ImmutableArray<TextChange> GetEdits() 70private ImmutableArray<TextChange> GetEditsForNonRawString() 121private ImmutableArray<TextChange> GetEditsForRawString() 159var trivialContentEdit = GetContentEditForRawString(insertInterpolations: false, dollarSignCount: -1); 178private ImmutableArray<TextChange> DetermineTotalEditsToMakeToRawString( 184using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 223ArrayBuilder<TextChange> edits, bool beforeSelection, int dollarSignsToAdd) 243private TextChange GetContentEditForRawString(
StringCopyPaste\StringCopyPasteCommandHandler.cs (3)
177foreach (var change in textChanges) 185ImmutableArray<TextChange> GetEdits(CancellationToken cancellationToken) 208ImmutableArray<TextChange> TryGetEditsFromKnownCopySource(
StringCopyPaste\UnknownSourcePasteProcessor.cs (7)
44public override ImmutableArray<TextChange> GetEdits() 86private ImmutableArray<TextChange> GetEditsForNonRawString() 88using var textChanges = TemporaryArray<TextChange>.Empty; 102private ImmutableArray<TextChange> GetEditsForRawString() 121using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 155private void AdjustWhitespaceAndAddTextChangesForSingleLineRawStringLiteral(ArrayBuilder<TextChange> edits) 228ArrayBuilder<TextChange> edits)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (4)
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (2)
3454private static string GetFormattedText(ITextBuffer buffer, IList<TextChange> changes) 3458foreach (var change in changes)
Intents\IntentTestsBase.cs (1)
73foreach (var change in documentChange.Value)
StringIndentation\StringIndentationTests.cs (1)
43using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes);
Microsoft.CodeAnalysis.CSharp.Features (32)
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)
52protected override TextChange? GetReturnTypeChange(SemanticModel semanticModel, SyntaxNode declaration, CancellationToken cancellationToken)
Completion\CompletionProviders\CrefCompletionProvider.cs (2)
375protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 382return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (2)
280protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 282return 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)
81public 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(
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
45protected 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);
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\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
48using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 68ArrayBuilder<TextChange> edits)
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
48using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 69ArrayBuilder<TextChange> edits)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\BindingAwaitTests.cs (1)
29TextChange change = new TextChange(span, "/*comment*/");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Metadata\MetadataTypeTests.cs (1)
365var change = new TextChange(span, text1);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (29)
IncrementalParsing\IncrementalParsingTests.cs (29)
496var change = new TextChange(span, "."); 528var change = new TextChange(span, " "); 3331var change = new TextChange(span, text1); 3414var change = new TextChange(span, "// "); 3451var change = new TextChange(span, "// "); 3530var change = new TextChange(new TextSpan(0, 0), items[1]); // Prepend 3629var change = new TextChange(span, "p"); 3650var change = new TextChange(span, ""); 3671var change = new TextChange(span, "["); 3692var change = new TextChange(span, "[Obsolete]"); 3713var change = new TextChange(span, "public"); 3735var change = new TextChange(span, "c"); 3759var change = new TextChange(span, "1, Attr2"); 3783var change = new TextChange(span, ", Attr2"); 3807var change = new TextChange(span, " [Attr2]"); 3831var change = new TextChange(span, "Arg"); 3855var change = new TextChange(span, "2"); 3881var change = new TextChange(span, "1, Attr2"); 3906var change = new TextChange(span, "[Attr]"); 3932var change = new TextChange(span, " [Attr2]"); 3958var change = new TextChange(span, ""); 3976var change = new TextChange(span, ".z"); 3994var change = new TextChange(span, " if (c) { }"); 4012var change = new TextChange(span, " else (c) { }"); 4026var change = new TextChange(span, ""); 4040var change = new TextChange(span, "{ "); 4055var change = new TextChange(span, ""); 4092var change = new TextChange(span, "["); 4157new TextChange[] {
Microsoft.CodeAnalysis.CSharp.Workspaces (12)
Formatting\CSharpSyntaxFormattingService.cs (4)
72public ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter( 144private static IList<TextChange> FormatToken( 151private static ImmutableArray<TextChange> FormatRange( 292public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
259LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken) 350LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
44public IList<TextChange> FormatRange( 76public IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.EditorFeatures (68)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (2)
55protected abstract IList<TextChange> FormatBasedOnEndToken(ParsedDocument document, int position, SyntaxFormattingOptions formattingOptions, CancellationToken cancellationToken); 207var insertChange = new TextChange(new TextSpan(insertPosition, 0), endingString);
AutomaticCompletion\BraceCompletionSessionProvider.BraceCompletionSession.cs (1)
454foreach (var change in result.TextChanges)
CommentSelection\AbstractCommentSelectionBase.cs (2)
79protected static void InsertText(ArrayBuilder<TextChange> textChanges, int position, string text) 82protected static void DeleteText(ArrayBuilder<TextChange> textChanges, TextSpan span)
CommentSelection\AbstractToggleBlockCommentBase.cs (6)
104var textChanges = ArrayBuilder<TextChange>.GetInstance(); 131BlockCommentSelectionHelper blockCommentSelection, ArrayBuilder<TextChange> textChanges, 162ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans, CommentSelectionInfo commentInfo) 216ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans, CommentSelectionInfo commentInfo) 252private static void AddBlockComment(CommentSelectionInfo commentInfo, TextSpan span, ArrayBuilder<TextChange> textChanges) 259ArrayBuilder<TextChange> textChanges, CommentSelectionInfo commentInfo)
CommentSelection\CommentSelectionResult.cs (2)
11internal readonly struct CommentSelectionResult(IEnumerable<TextChange> textChanges, IEnumerable<CommentTrackingSpan> trackingSpans, Operation resultOperation) 16public ImmutableArray<TextChange> TextChanges { get; } = [.. textChanges];
CommentSelection\CommentUncommentSelectionCommandHandler.cs (10)
79var textChanges = ArrayBuilder<TextChange>.GetInstance(); 100ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans) 162private static void AddSingleLineComments(SnapshotSpan span, ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans, ITextSnapshotLine firstLine, ITextSnapshotLine lastLine, CommentSelectionInfo commentInfo) 171private static void AddBlockComment(SnapshotSpan span, ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans, CommentSelectionInfo commentInfo) 183ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> spansToSelect) 211private static bool TryUncommentExactlyBlockComment(CommentSelectionInfo info, SnapshotSpan span, ArrayBuilder<TextChange> textChanges, 229private static void UncommentContainingBlockComment(CommentSelectionInfo info, SnapshotSpan span, ArrayBuilder<TextChange> textChanges, 257private static void UncommentPosition(CommentSelectionInfo info, ArrayBuilder<TextChange> textChanges, 270private static bool TryUncommentSingleLineComments(CommentSelectionInfo info, SnapshotSpan span, ArrayBuilder<TextChange> textChanges, 302CommentSelectionInfo info, ArrayBuilder<TextChange> textChanges, ITextSnapshotLine firstLine, ITextSnapshotLine lastLine, int indentToCommentAt)
CommentSelection\ToggleLineCommentCommandHandler.cs (3)
81var textChanges = ArrayBuilder<TextChange>.GetInstance(); 117ArrayBuilder<TextChange> textChanges, 139ArrayBuilder<TextChange> textChanges,
Copilot\CopilotWpfTextCreationListener.cs (1)
117using var _ = PooledObjects.ArrayBuilder<TextChange>.GetInstance(out var textChanges);
Editor\IContainedDocument.cs (1)
13public ITextSnapshot ApplyChanges(IEnumerable<TextChange> changes);
Editor\TextEditApplication.cs (3)
23public static void UpdateText(ImmutableArray<TextChange> textChanges, ITextBuffer buffer, EditOptions options) 31private static void UpdateText(ImmutableArray<TextChange> textChanges, ITextBuffer buffer, ITextSnapshot oldSnapshot, SourceText oldText, EditOptions options) 40foreach (var change in textChanges)
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (1)
100var textChange = new TextChange(span, newLine);
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (1)
58var textChange = new TextChange(span, newText);
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (1)
171var textChange = new TextChange();
EditorConfigSettings\Updater\SettingsUpdaterBase.cs (1)
72public async Task<IReadOnlyList<TextChange>?> GetChangedEditorConfigAsync(CancellationToken token)
ExternalAccess\IntelliCode\Api\IIntentSourceProvider.cs (4)
28internal readonly struct IntentRequestContext(string intentName, SnapshotSpan currentSnapshotSpan, ImmutableArray<TextChange> textEditsToPrior, TextSpan priorSelection, string? intentData) 50public ImmutableArray<TextChange> PriorTextEdits { get; } = textEditsToPrior; 62internal readonly struct IntentSource(string title, string actionName, ImmutableDictionary<DocumentId, ImmutableArray<TextChange>> documentChanges) 72public readonly ImmutableDictionary<DocumentId, ImmutableArray<TextChange>> DocumentChanges = documentChanges;
ExternalAccess\IntelliCode\IntentProcessor.cs (2)
95using var _ = PooledDictionary<DocumentId, ImmutableArray<TextChange>>.GetInstance(out var results); 109private static async Task<ImmutableArray<TextChange>?> GetTextChangesForDocumentAsync(
ExternalAccess\UnitTestGenerator\Api\WrappedAddImportFixData.cs (1)
24public ImmutableArray<TextChange> TextChanges => Underlying.TextChanges;
ExternalAccess\VSTypeScript\Api\IVSTypeScriptFormattingInteractionService.cs (4)
31Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, DocumentOptionSet? documentOptions, CancellationToken cancellationToken); 36Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, DocumentOptionSet? documentOptions, CancellationToken cancellationToken); 43Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, char typedChar, int position, DocumentOptionSet? documentOptions, CancellationToken cancellationToken); 48Task<ImmutableArray<TextChange>> GetFormattingChangesOnReturnAsync(Document document, int position, DocumentOptionSet? documentOptions, CancellationToken cancellationToken);
ExternalAccess\VSTypeScript\Api\VSTypeScriptExtensions.cs (1)
16public static void ApplyTextChanges(this Workspace workspace, DocumentId id, IEnumerable<TextChange> textChanges, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\VSTypeScriptFormattingInteractionService.cs (4)
33public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken) 36public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken) 39public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, char typedChar, int position, CancellationToken cancellationToken) 42public Task<ImmutableArray<TextChange>> GetFormattingChangesOnReturnAsync(Document document, int position, CancellationToken cancellationToken)
ExtractMethod\ExtractMethodCommandHandler.cs (1)
197ITextBuffer textBuffer, IEnumerable<TextChange> changes, IBackgroundWorkIndicatorContext waitContext)
Formatting\FormatCommandHandler.cs (1)
142IList<TextChange>? textChanges;
Formatting\IFormattingInteractionService.cs (4)
31Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken); 36Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken); 43Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, char typedChar, int position, CancellationToken cancellationToken); 48Task<ImmutableArray<TextChange>> GetFormattingChangesOnReturnAsync(Document document, int position, CancellationToken cancellationToken);
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (1)
540private static async Task<IEnumerable<TextChange>> GetTextChangesFromTextDifferencingServiceAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken = default)
IntelliSense\AsyncCompletion\CommitManager.cs (1)
250var textChange = change.TextChange;
Interactive\InteractiveWorkspace.cs (1)
49foreach (var change in changes)
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
187var textChange = new TextChange(new TextSpan(_snapshotSpan.Start, _snapshotSpan.Length), _stateMachine.TrackingSession.OriginalName);
Shared\Extensions\ITextBufferExtensions.cs (3)
65public static ITextSnapshot ApplyChange(this ITextBuffer buffer, TextChange change) 77public static ITextSnapshot ApplyChanges(this ITextBuffer buffer, IEnumerable<TextChange> changes) 85foreach (var change in changes)
Shared\Extensions\WorkspaceExtensions.cs (2)
39internal static void ApplyTextChanges(this Workspace workspace, DocumentId id, IEnumerable<TextChange> textChanges, CancellationToken cancellationToken) 46private static Solution UpdateDocument(this Solution solution, DocumentId id, IEnumerable<TextChange> textChanges, CancellationToken cancellationToken)
TextDiffing\EditorTextDifferencingService.cs (2)
27public Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken) 30public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (7)
Completion\AbstractCompletionProviderTests.cs (2)
756var textChange = (await service.GetChangeAsync(document, firstItem, commitChar, CancellationToken.None)).TextChange; 769var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString());
Formatting\CoreFormatterTestsBase.cs (2)
161private static string ApplyResultAndGetFormattedText(ITextBuffer buffer, IList<TextChange> changes) 165foreach (var change in changes)
Workspaces\EditorTestHostDocument.cs (1)
224foreach (var change in changes)
Workspaces\TestFormattingRuleFactoryServiceFactory.cs (2)
54public IEnumerable<TextChange> FilterFormattedChanges(DocumentId document, TextSpan span, IList<TextChange> changes)
Microsoft.CodeAnalysis.EditorFeatures.Text (2)
Extensions.SnapshotSourceText.cs (2)
184public override SourceText WithChanges(IEnumerable<TextChange> changes) 211foreach (var change in changes)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (9)
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (7)
704private static void UncommentSelection(string code, IEnumerable<TextChange> expectedChanges, Span expectedSelectedSpan, bool supportBlockComments) 707private static void UncommentSelection(string code, IEnumerable<TextChange> expectedChanges, IEnumerable<Span> expectedSelectedSpans, bool supportBlockComments) 710private static void CommentSelection(string code, IEnumerable<TextChange> expectedChanges, bool supportBlockComments) 713private static void CommentSelection(string code, IEnumerable<TextChange> expectedChanges, IEnumerable<Span> expectedSelectedSpans, bool supportBlockComments) 716private static void CommentSelection(ExportProvider exportProvider, ITextView textView, IEnumerable<TextChange> expectedChanges, IEnumerable<Span> expectedSelectedSpans, bool supportBlockComments) 724IEnumerable<TextChange> expectedChanges, 740IEnumerable<TextChange> expectedChanges,
Completion\CompletionServiceTests.cs (1)
68var expectedChange = new TextChange(item.Span, nameof(DebugAssertTestCompletionProvider));
Snippets\RoslynLSPSnippetConvertTests.cs (1)
492var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length));
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
InlineHints\AbstractInlineHintsTests.vb (1)
60Dim textChanges = New List(Of TextChange)
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (1)
AddPackage\AspNetCoreAddPackageCodeAction.cs (1)
55private static async Task<ImmutableArray<TextChange>> GetTextChangesAsync(
Microsoft.CodeAnalysis.ExternalAccess.Copilot (3)
Analyzer\CopilotAnalysisUtilities.cs (1)
20IEnumerable<TextChange> textChanges,
CodeMapper\ICSharpCopilotMapCodeService.cs (1)
15Task<ImmutableArray<TextChange>?> MapCodeAsync(
Internal\CodeMapper\CopilotCSharpMapCodeService.cs (1)
30public Task<ImmutableArray<TextChange>?> MapCodeAsync(Document document, ImmutableArray<string> contents, ImmutableArray<(Document, TextSpan)> focusLocations, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (15)
Completion\IFSharpCommonCompletionProvider.cs (2)
21public abstract Task<TextChange?> GetTextChangeAsync( 22Func<CompletionItem, char?, CancellationToken, Task<TextChange?>> baseGetTextChangeAsync,
Editor\IFSharpEditorFormattingService.cs (4)
29Task<IList<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, CancellationToken cancellationToken); 34Task<IList<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 41Task<IList<TextChange>?> GetFormattingChangesAsync(Document document, char typedChar, int position, CancellationToken cancellationToken); 46Task<IList<TextChange>?> GetFormattingChangesOnReturnAsync(Document document, int position, CancellationToken cancellationToken);
Internal\Completion\FSharpInternalCommonCompletionProvider.cs (1)
31protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken)
Internal\Editor\FSharpEditorFormattingService.cs (8)
44public Task<IList<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, CancellationToken cancellationToken) 49public Task<IList<TextChange>?> GetFormattingChangesAsync(Document document, char typedChar, int position, CancellationToken cancellationToken) 54public Task<IList<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 59public Task<IList<TextChange>?> GetFormattingChangesOnReturnAsync(Document document, int position, CancellationToken cancellationToken) 79async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken) 85async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, char typedChar, int position, CancellationToken cancellationToken) 91async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken) 97async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesOnReturnAsync(Document document, int position, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (2)
InlineHints\OmniSharpInlineHintsService.cs (2)
40TextChange? replacementTextChange, 53public readonly TextChange? ReplacementTextChange { get; }
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (6)
RazorCSharpFormattingInteractionService.cs (2)
31public static async Task<ImmutableArray<TextChange>> GetFormattingChangesAsync( 60public static IList<TextChange> GetFormattedTextChanges(
RazorMappedSpanResult.cs (1)
33internal readonly record struct RazorMappedEditResult(string FilePath, TextChange[] TextChanges)
RazorMappingServiceWrapper.cs (3)
22public async Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync( 30var changes = new (string mappedFilePath, TextChange mappedTextChange)[changesCount]; 40foreach (var textChange in mappedEdit.TextChanges)
Microsoft.CodeAnalysis.Features (134)
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( 119Document 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)
74internal readonly struct BraceCompletionResult(ImmutableArray<TextChange> textChanges, LinePosition caretLocation) 80public 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 (3)
94using var _ = PooledHashSet<TextChange>.GetInstance(out var insertionOnlyChanges); 96var changes = ProducerConsumer<TextChange>.RunParallelStreamAsync( 185Action<TextChange> callback,
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 TextChange? GetReturnTypeChange(SemanticModel semanticModel, SyntaxNode declaration, CancellationToken cancellationToken); 170using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder); 191var 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)
73public sealed override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem item, char? ch, CancellationToken cancellationToken) 74=> 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)
469public sealed override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 470=> Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, GetInsertionText(selectedItem, ch)));
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (2)
143using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder); 167var 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 (6)
35/// passed to <see cref="SourceText.WithChanges(IEnumerable{TextChange})"/> for the text snapshot corresponding to 42IEnumerable<TextChange> textChanges, 63private static ImmutableArray<TextChange> Normalize(IEnumerable<TextChange> textChanges) 65using var _ = PooledObjects.ArrayBuilder<TextChange>.GetInstance(out var builder); 66foreach (var textChange in textChanges)
Copilot\ICopilotChangeAnalysisService.cs (4)
39Document document, ImmutableArray<TextChange> changes, CancellationToken cancellationToken); 54ImmutableArray<TextChange> changes, 83ImmutableArray<TextChange> changes, 105foreach (var change in changes)
Copilot\IRemoteCopilotChangeAnalysisService.cs (1)
18Checksum solutionChecksum, DocumentId documentId, ImmutableArray<TextChange> edits, CancellationToken cancellationToken);
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)
218private 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)
110TextChange? replacementTextChange = null;
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(
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)
43var 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)
59protected 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)
24protected 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); 188private static async Task<Document> GetDocumentWithSnippetAsync(Document document, ImmutableArray<TextChange> snippets, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (3)
19protected abstract Task<TextChange?> GetAccessibilityModifiersChangeAsync(Document document, int position, CancellationToken cancellationToken); 21protected sealed override async Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken) 25var 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\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
59foreach (var formattingChange in formattingChanges) 61var change = formattingChange;
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.LanguageServer.Protocol (16)
Extensions\ProtocolConversions.cs (6)
342public static LSP.TextEdit TextChangeToTextEdit(TextChange textChange, SourceText oldText) 352public static TextChange TextEditToTextChange(LSP.TextEdit edit, SourceText oldText) 355public static TextChange ContentChangeEventToTextChange(LSP.TextDocumentContentChangeEvent changeEvent, SourceText text) 403ImmutableArray<TextChange> textChanges; 423foreach (var textChange in textChanges) 434var textChange = textChanges[i];
ExternalAccess\Razor\SimplifyMethodHandler.cs (1)
55var pendingChange = ProtocolConversions.TextEditToTextChange(textEdit, originalSourceText);
Handler\CodeActions\CodeActionResolveHelper.cs (1)
286IEnumerable<TextChange> textChanges;
Handler\Completion\CompletionResultFactory.cs (2)
519var change = completionChange.TextChange; 538foreach (var change in completionChange.TextChanges)
Handler\InlineCompletions\InlineCompletionsHandler.cs (3)
186var textChange = new TextChange(snippetShortcut, snippetFullText); 208using var _1 = ArrayBuilder<TextChange>.GetInstance(out var lspTextChanges); 234static TextSpan GetAdjustedSpan(ImmutableArray<TextChange> textChanges, TextSpan originalSpan)
Handler\OnAutoInsert\OnAutoInsertHandler.cs (3)
224static async Task<TextChange> GetCollapsedChangeAsync(ImmutableArray<TextChange> textChanges, Document oldDocument, CancellationToken cancellationToken) 231static string GetTextChangeTextWithCaretAtLocation(SourceText sourceText, TextChange textChange, LinePosition desiredCaretLinePosition)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (3)
Completion\CompletionResolveTests.cs (1)
502var textChange = new TextChange(span: new TextSpan(start: 77, length: 9), newText: @"public override void M()
Diagnostics\PullDiagnosticTests.cs (1)
700var textChange = ProtocolConversions.TextEditToTextChange(textEdit, workspaceText);
MapCode\MapCodeTests.cs (1)
34public async Task<ImmutableArray<TextChange>?> MapCodeAsync(
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (36)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
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\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.PublicApiAnalyzers (31)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Services\AssetSynchronization\RemoteAssetSynchronizationService.cs (1)
59ImmutableArray<TextChange> textChanges,
Services\Copilot\RemoteCopilotChangeAnalysisService.cs (1)
27ImmutableArray<TextChange> edits,
Services\EncapsulateField\RemoteEncapsulateFieldService.cs (1)
25public ValueTask<ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>> EncapsulateFieldsAsync(
Microsoft.CodeAnalysis.Remote.Workspaces (1)
IRemoteAssetSynchronizationService.cs (1)
31ImmutableArray<TextChange> textChanges,
Microsoft.CodeAnalysis.ResxSourceGenerator (31)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.UnitTests (15)
Text\SourceTextTests.cs (1)
192var change = new TextChange(span, text.ToString(span));
Text\TextChangeTests.cs (14)
255var changes = new TextChange[] { 271var expected = changes[i]; 272var actual = result[i]; 291private static void AssertChangedTextLinesHelper(string originalText, params TextChange[] changes) 976Assert.Equal("new TextChange(new TextSpan(0, 0), null)", default(TextChange).GetDebuggerDisplay()); 993ArrayBuilder<TextChange> oldChangesBuilder = ArrayBuilder<TextChange>.GetInstance(); 1002var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText); 1014ArrayBuilder<TextChange> newChangesBuilder = ArrayBuilder<TextChange>.GetInstance(); 1022var newChange = new TextChange(new TextSpan(i, length: random.Next(editedLength - i)), newText); 1247var edits1 = new TextChange[] 1258var edits2 = new TextChange[] 1272foreach (var change in changes)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
176changes As ArrayBuilder(Of TextChange), 232changes As ArrayBuilder(Of TextChange),
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.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler.vb (2)
57Protected Overrides Function FormatBasedOnEndToken(document As ParsedDocument, position As Integer, formattingOptions As SyntaxFormattingOptions, cancellationToken As CancellationToken) As IList(Of TextChange) 60Return SpecializedCollections.EmptyList(Of TextChange)
Microsoft.CodeAnalysis.VisualBasic.Features (5)
Completion\CompletionProviders\AwaitCompletionProvider.vb (1)
46Protected Overrides Function GetReturnTypeChange(semanticModel As SemanticModel, declaration As SyntaxNode, cancellationToken As CancellationToken) As TextChange?
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (3)
230Protected Overrides Function GetTextChangeAsync(selectedItem As CompletionItem, ch As Char?, cancellationToken As CancellationToken) As Task(Of TextChange?) 233Dim change As TextChange 242Return 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)
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
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
176changes As ArrayBuilder(Of TextChange), 232changes As ArrayBuilder(Of TextChange),
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.Workspaces (124)
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)
268public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 271internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken) 283public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 286internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 298public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 301internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 304private static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 308? SpecializedCollections.EmptyList<TextChange>() 312internal 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)
22public static async ValueTask<ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>> GetDocumentTextChangesAsync( 27using var _ = ArrayBuilder<(DocumentId, ImmutableArray<TextChange>)>.GetInstance(out var builder); 50ImmutableArray<(DocumentId documentId, ImmutableArray<TextChange> textChanges)> documentTextChanges,
Rename\IRemoteRenamerService.cs (2)
210ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> documentTextChanges, 228public readonly ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> DocumentTextChanges = documentTextChanges;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
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\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\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);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
Formatting\FormattingTestBase.cs (2)
99private static bool TryAdjustSpans(SourceText inputText, IList<TextChange> changes, SourceText outputText, ImmutableArray<TextSpan> inputSpans, out ImmutableArray<TextSpan> outputSpans) 127protected static void AssertResult(string expected, SourceText sourceText, IList<TextChange> result)
TestDocumentServiceProvider.cs (1)
65public Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync(
Microsoft.VisualStudio.LanguageServices (23)
EditorConfigSettings\Common\EditorTextUpdater.cs (1)
26public void UpdateText(IReadOnlyList<TextChange> changes)
ProjectSystem\VisualStudioWorkspaceImpl.cs (2)
662async Task<MultiDictionary<string, (TextChange TextChange, ProjectId ProjectId)>> GetMappedTextChangesAsync(SolutionChanges solutionChanges) 664var filePathToMappedTextChanges = new MultiDictionary<string, (TextChange TextChange, ProjectId ProjectId)>();
Venus\ContainedDocument.cs (17)
214public ITextSnapshot ApplyChanges(IEnumerable<TextChange> changes) 233private ITextSnapshot ApplyChanges(SourceText originalText, IEnumerable<TextChange> changes) 261private IEnumerable<TextChange> FilterTextChanges(SourceText originalText, List<TextSpan> editorVisibleSpansInOriginal, IEnumerable<TextChange> changes) 270using var pooledObject = SharedPools.Default<List<TextChange>>().GetPooledObject(); 328private static bool WhitespaceOnEdges(TextSpan visibleTextSpan, TextChange change) 348private IEnumerable<TextChange> GetSubTextChanges(SourceText originalText, TextChange changeInOriginalText, TextSpan visibleSpanInOriginalText) 350using var changes = SharedPools.Default<List<TextChange>>().GetPooledObject(); 365SourceText originalText, TextSpan visibleSpanInOriginalText, string leftText, string rightText, int offsetInOriginalText, List<TextChange> changes) 386if (TryGetSubTextChange(originalText, visibleSpanInOriginalText, rightText, spanInOriginalText, spanInRightText, out var textChange)) 398private IEnumerable<TextChange> GetSubTextChanges( 417if (TryGetSubTextChange(originalText, visibleSpanInOriginalText, rightText, spanInOriginalText, spanInRightText.ToTextSpan(), out var textChange)) 504string rightText, TextSpan spanInOriginalText, TextSpan spanInRightText, out TextChange textChange) 720IEnumerable<TextChange> changes, 730foreach (var change in changes) 818foreach (var change in newChanges)
Venus\ContainedDocument.DocumentServiceProvider.cs (1)
72public override async Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync(
Workspace\VisualStudioFormattingRuleFactoryServiceFactory.cs (2)
90public IEnumerable<TextChange> FilterFormattedChanges(DocumentId documentId, TextSpan span, IList<TextChange> changes)
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
512foreach (var change in changes)
Microsoft.VisualStudio.LanguageServices.UnitTests (2)
Completion\MockCompletionProvider.vb (2)
25Public Overrides Function GetTextChangeAsync(document As Document, selectedItem As CompletionItem, ch As Char?, cancellationToken As CancellationToken) As Task(Of TextChange?) 26Return Task.FromResult(Of TextChange?)(New TextChange(selectedItem.Span, "InsertionText"))
Microsoft.VisualStudio.LanguageServices.Xaml (3)
Features\AutoInsert\XamlAutoInsertResult.cs (1)
11public TextChange TextChange { get; set; }
Features\Formatting\IXamlFormattingService.cs (2)
18Task<IList<TextChange>> GetFormattingChangesAsync(TextDocument document, XamlFormattingOptions options, TextSpan? textSpan, CancellationToken cancellationToken); 19Task<IList<TextChange>> GetFormattingChangesAsync(TextDocument document, XamlFormattingOptions options, char typedChar, int position, CancellationToken cancellationToken);
Roslyn.Diagnostics.Analyzers (36)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
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\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 (8)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
259LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken) 350LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
44public IList<TextChange> FormatRange( 76public IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken)
Roslyn.Diagnostics.VisualBasic.Analyzers (8)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
176changes As ArrayBuilder(Of TextChange), 232changes As ArrayBuilder(Of TextChange),
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
Test.Utilities (31)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
Text.Analyzers (36)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
103public static TextChangeRange ToTextChangeRange(this TextChange textChange)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
237public static TextChange SimpleDiff(this TextChange textChange, string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\ISmartTokenFormatter.cs (1)
13IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
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\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)