529 instantiations of TextChange
IdeCoreBenchmarks (3)
IncrementalSourceGeneratorBenchmarks.cs (1)
178var changedText = sourceText.WithChanges(new TextChange(sourceText.Lines[0].Span, $"// added text{i}"));
SyntacticChangeRangeBenchmark.cs (2)
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 "));
Microsoft.CodeAnalysis (4)
Syntax\SyntaxDiffer.cs (2)
45return new[] { new TextChange(new TextSpan(0, 0), after.GetText().ToString()) }; 68return reducedChanges.Select(c => new TextChange(c.Range.Span, c.NewText!)).ToList();
Text\SourceText.cs (2)
751return this.WithChanges(new TextChange(span, newText)); 812textChanges.Add(new TextChange(range.Span, newt));
Microsoft.CodeAnalysis.CodeStyle (6)
AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
54=> SpecializedCollections.SingletonEnumerable<TextChange>(new TextChange(textSpan, _newString));
AbstractTriviaFormatter.cs (2)
824=> new(span, GetWhitespaceString(lineColumn, delta)); 829changes.Add(new TextChange(span, newText));
FormattingAnalyzerHelper.cs (2)
43change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 52change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
FormattingExtensions.cs (1)
282return new TextChange(span, newText);
Microsoft.CodeAnalysis.CodeStyle.Fixes (8)
AbstractConflictMarkerCodeFixProvider.cs (8)
320edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 324edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 333edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 337edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 346edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 352edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 358edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 363edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
CSharpTriviaFormatter.cs (2)
269changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 379changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
ArrowExpressionClausePlacementCodeFixProvider.cs (2)
98edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 99edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
ConditionalExpressionPlacementCodeFixProvider.cs (2)
100edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 101edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
ConvertNamespaceTransform.cs (1)
156return new TextChange(new TextSpan(textLine.Start, commonIndentation), newText: "");
Microsoft.CodeAnalysis.CSharp.EditorFeatures (22)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
658var insertChange = new TextChange(new TextSpan(insertionPosition, 0), bracePair);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
208var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (3)
121return new TextChange(new TextSpan(position + 1, 0), "\"\"\""); 178return new TextChange(new TextSpan(position + 1, 0), "\""); 235return new TextChange(new TextSpan(token.GetRequiredParent().Span.End, 0), "\"");
StringCopyPaste\KnownSourcePasteProcessor.cs (9)
131return ImmutableArray.Create(new TextChange(_selectionSpanBeforePaste, builder.ToString())); 201edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 205edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 210edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace)); 226edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace)); 230edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 250edits.Add(new TextChange(new TextSpan(interpolation.OpenBraceToken.Span.End, 0), new string('{', dollarSignsToAdd))); 251edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd))); 359return new TextChange(_selectionSpanBeforePaste, builder.ToString());
StringCopyPaste\UnknownSourcePasteProcessor.cs (8)
102textChanges.Add(new TextChange( 133edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 137edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 148edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 177edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace)); 215edits.Add(new TextChange(change.OldSpan.ToTextSpan(), buffer.ToString())); 221edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace)); 339edits.Add(new TextChange(change.OldSpan.ToTextSpan(), buffer.ToString()));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
StringIndentation\StringIndentationTests.cs (1)
58changes.Add(new TextChange(new TextSpan(lineStart + offset - 1, 1), "|"));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenTupleTest.cs (1)
22649var newText = text.WithChanges(new TextChange(new TextSpan(pos, 0), " ")); // add space before closing-paren
Microsoft.CodeAnalysis.CSharp.Features (28)
ArrowExpressionClausePlacementCodeFixProvider.cs (2)
98edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 99edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (2)
128newLineEdit = new TextChange(new TextSpan(annotatedNewline.SpanStart, 0), annotatedNewline.ToString()); 200mergedChanges.Add(new TextChange(newTextChangeSpan, newTextChangeText));
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (4)
259return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - SpaceEqualsString.Length)); 266return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - EqualsString.Length)); 273return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - ColonString.Length)); 277return new TextChange(selectedItem.Span, displayText);
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
388return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.cs (1)
133return Task.FromResult<TextChange?>(new TextChange(
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
285return Task.FromResult<TextChange?>(new TextChange(
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
202new TextChange(TextSpan.FromBounds(replacementStart, tokenOnLeft.Span.End), text),
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (5)
91builder.Add(new TextChange(new TextSpan(expression.SpanStart, 0), castText)); 103builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), ")")); 108builder.Add(new TextChange(new TextSpan(questionToken.Value.SpanStart, 0), ")")); 110builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), "")); 116builder.Add(new TextChange(tokenOnLeft.Span, ""));
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
143var fullTextChange = new TextChange(
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (1)
88return new TextChange(selectedItem.Span, insertionText);
Completion\CompletionProviders\TupleNameCompletionProvider.cs (1)
118return Task.FromResult<TextChange?>(new TextChange(
ConditionalExpressionPlacementCodeFixProvider.cs (2)
100edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 101edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
ConvertNamespaceTransform.cs (1)
156return new TextChange(new TextSpan(textLine.Start, commonIndentation), newText: "");
InlineHints\CSharpInlineTypeHintsService.cs (3)
86? new TypeHint(parameter.Type, span, textChange: new TextChange(span, parameter.Type.ToDisplayString(s_minimalTypeStyle) + " "), trailingSpace: true) 100return new(type, span, new TextChange(span, " " + type.ToDisplayString(s_minimalTypeStyle)), leadingSpace: true); 119return new TypeHint(type, span, new TextChange(displayAllSpan.Span, type.ToDisplayString(s_minimalTypeStyle)), trailingSpace: trailingSpace);
Snippets\CSharpElseSnippetProvider.cs (1)
70return Task.FromResult(ImmutableArray.Create(new TextChange(TextSpan.FromBounds(position, position), elseClause.ToFullString())));
Snippets\CSharpSnippetFunctionService.cs (1)
59var textChange = new TextChange(caseGenerationLocation, str);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\BindingAwaitTests.cs (1)
28TextChange change = new TextChange(span, "/*comment*/");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Symbols\Metadata\MetadataTypeTests.cs (2)
364var change = new TextChange(span, text1); 379change = new TextChange(span, text2);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (41)
IncrementalParsing\IncrementalParsingTests.cs (39)
590var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 604var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 2373new TextChange(new TextSpan(str.IndexOf(" abc", StringComparison.Ordinal), 0), "//"), 2374new TextChange(new TextSpan(str.IndexOf(" 123", StringComparison.Ordinal), 0), "//"), 2375new TextChange(new TextSpan(str.IndexOf(" def", StringComparison.Ordinal), 0), "//")); 2395var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), "{")); 2411var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"System.Console.WriteLine(false) 2470var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"if (false) 2526var change = new TextChange(span, text1); 2540change = new TextChange(span, text2); 2609var change = new TextChange(span, "// "); 2646var change = new TextChange(span, "// "); 2725var change = new TextChange(new TextSpan(0, 0), items[1]); // Prepend 2824var change = new TextChange(span, "p"); 2845var change = new TextChange(span, ""); 2866var change = new TextChange(span, "["); 2887var change = new TextChange(span, "[Obsolete]"); 2908var change = new TextChange(span, "public"); 2930var change = new TextChange(span, "c"); 2954var change = new TextChange(span, "1, Attr2"); 2978var change = new TextChange(span, ", Attr2"); 3002var change = new TextChange(span, " [Attr2]"); 3026var change = new TextChange(span, "Arg"); 3050var change = new TextChange(span, "2"); 3076var change = new TextChange(span, "1, Attr2"); 3101var change = new TextChange(span, "[Attr]"); 3127var change = new TextChange(span, " [Attr2]"); 3153var change = new TextChange(span, ""); 3171var change = new TextChange(span, ".z"); 3189var change = new TextChange(span, " if (c) { }"); 3207var change = new TextChange(span, " else (c) { }"); 3221var change = new TextChange(span, ""); 3235var change = new TextChange(span, "{ "); 3250var change = new TextChange(span, ""); 3287var change = new TextChange(span, "["); 3316new TextChange(new TextSpan(locationOfChange, 0), "/*"), 3317new TextChange(new TextSpan(locationOfChange + widthOfChange, 0), "*/") 3326var newText = oldText.WithChanges(new TextChange(new TextSpan(locationOfChange, widthOfChange), "")); 3352var newText = oldText.WithChanges(new TextChange(new TextSpan(oldText.Length, 0), newChar.ToString()));
Syntax\SyntaxNodeTests.cs (2)
884var tree2 = tree1.WithChangedText(tree1.GetText().WithChanges(new TextChange(default, " "))); 895var 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 (3)
CSharpTriviaFormatter.cs (2)
269changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 379changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
OrganizeImports\CSharpOrganizeImportsService.Rewriter.cs (1)
81this.TextChanges.Add(new TextChange(GetTextSpan(list), GetNewText(organizedList)));
Microsoft.CodeAnalysis.EditorFeatures (13)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (1)
206var insertChange = new TextChange(new TextSpan(insertPosition, 0), endingString);
CommentSelection\AbstractCommentSelectionBase.cs (2)
83=> textChanges.Add(new TextChange(new TextSpan(position, 0), text)); 86=> textChanges.Add(new TextChange(span, string.Empty));
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (1)
107var 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)
212buffer.ApplyChange(new TextChange(TextSpan.FromBounds(caretPoint - 2, caretPoint), string.Empty));
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
185var textChange = new TextChange(new TextSpan(_snapshotSpan.Start, _snapshotSpan.Length), _stateMachine.TrackingSession.OriginalName);
TextDiffing\EditorTextDifferencingService.cs (1)
54new TextChange(
Microsoft.CodeAnalysis.EditorFeatures.Cocoa (2)
Snippets\CSharpSnippets\SnippetFunctions\SnippetFunctionGenerateSwitchCases.cs (1)
82var textChange = new TextChange(new TextSpan(startPosition, endPosition - startPosition), str);
Snippets\SnippetFunctions\AbstractSnippetFunctionSimpleTypeName.cs (1)
69var textChange = new TextChange(originalTextSpan, _fullyQualifiedName);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Completion\AbstractCompletionProviderTests.cs (2)
605textChange = new TextChange(textChange.Span, textChange.NewText.TrimEnd(commitChar) + commitChar); 613var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString());
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (88)
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 (2)
69var expectedChange = new TextChange(item.Span, nameof(DebugAssertTestCompletionProvider)); 127return Task.FromResult(CompletionChange.Create(new TextChange(item.Span, nameof(DebugAssertTestCompletionProvider))));
Diagnostics\DiagnosticsSquiggleTaggerProviderTests.cs (1)
68workspace.TryApplyChanges(document.WithText(text.WithChanges(new TextChange(new TextSpan(text.Length - 1, 1), string.Empty))).Project.Solution);
Preview\PreviewWorkspaceTests.cs (1)
173var newDocument = oldDocument.WithText(oldText.WithChanges(new TextChange(new TextSpan(0, oldText.Length), "class C { }")));
Snippets\RoslynLSPSnippetConvertTests.cs (3)
407ImmutableArray<SnippetPlaceholder>.Empty, new TextChange(new TextSpan(8, 0), "quux"), triggerLocation: 12, CancellationToken.None).Result; 418ImmutableArray<SnippetPlaceholder>.Empty, new TextChange(new TextSpan(4, 4), "bar quux"), triggerLocation: 12, CancellationToken.None).Result; 495var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length));
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
IntelliSense\CSharpCompletionCommandHandlerTests.vb (2)
8218New TextChange(New TextSpan(0, _caretPosition), newText)) 8260Return Task.FromResult(CompletionChange.Create(New TextChange(item.Span, commitText)))
Microsoft.CodeAnalysis.Features (53)
AbstractConflictMarkerCodeFixProvider.cs (8)
320edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 324edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 333edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 337edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 346edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 352edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 358edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 363edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
BraceCompletion\AbstractBraceCompletionService.cs (1)
64var braceTextEdit = new TextChange(TextSpan.FromBounds(closingPoint, closingPoint), ClosingBrace.ToString());
CodeFixes\Configuration\ConfigurationUpdater.cs (6)
464var textChange = new TextChange(); 517textChange = new TextChange(curLine.Span, $"{untrimmedKey}={newOptionValue}{newSeverityValue}{commentValue}"); 573textChange = new TextChange(curLine.Span, $"{untrimmedKey}={newSeverityValue}{commentValue}"); 737var textChange = new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry); 747var textChange = new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry); 785var 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 (1)
233return CompletionChange.Create(new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractAwaitCompletionProvider.cs (4)
186builder.Add(new TextChange(new TextSpan(GetSpanStart(declaration), 0), syntaxFacts.GetText(syntaxKinds.AsyncKeyword) + " ")); 191builder.Add(new TextChange(item.Span, _awaitKeyword)); 203builder.Add(new TextChange(new TextSpan(expr.SpanStart, 0), _awaitKeyword + " ")); 210builder.Add(new TextChange(TextSpan.FromBounds(dotToken.Value.SpanStart, item.Span.End), replacementText));
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
293new 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)
118return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
378=> Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, GetInsertionText(selectedItem, ch)));
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (2)
120return CompletionChange.Create(new TextChange(completionItem.Span, completionText)); 165builder.Add(new TextChange(completionItem.Span, insertText));
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (2)
59change = new TextChange(textSpan, snippetText); 130var textChange = new TextChange(span, string.Empty);
Completion\Utilities.cs (2)
22return new TextChange(new TextSpan(0, 0), ""); 42return new TextChange(totalOldSpan, newText.ToString(totalNewSpan));
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
226new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText)));
EmbeddedLanguages\DateAndTime\EmbeddedCompletionContext.cs (1)
145new TextChange(_replacementSpan, displayText)),
EmbeddedLanguages\RegularExpressions\LanguageServices\EmbeddedCompletionContext.cs (1)
64new TextChange(replacementSpan, escapedInsertionText),
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (2)
291new TextChange(new TextSpan(context.Position, 0), name), newPosition: null))); 459new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText),
FormattingAnalyzerHelper.cs (2)
43change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 52change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
112new TextChange(textSpan, inlineHintText),
Snippets\RoslynLSPSnippetConverter.cs (1)
116var newTextChange = new TextChange(extendedSpan, newString);
Snippets\SnippetFunctionService.cs (1)
43var textChange = new TextChange(fieldSpan, fullyQualifiedTypeName);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
77return new TextChange(TextSpan.FromBounds(position, position), expressionStatement.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractConstructorSnippetProvider.cs (1)
42return ImmutableArray.Create(new TextChange(TextSpan.FromBounds(position, position), constructorDeclaration.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractForEachLoopSnippetProvider.cs (1)
35var snippetTextChange = new TextChange(TextSpan.FromBounds(position, position), forEachStatementSyntax.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractIfSnippetProvider.cs (1)
29return new TextChange(TextSpan.FromBounds(position, position), ifStatement.ToFullString());
Snippets\SnippetProviders\AbstractPropertySnippetProvider.cs (1)
26return ImmutableArray.Create(new TextChange(TextSpan.FromBounds(position, position), propertyDeclaration.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (1)
28var snippetTextChange = new TextChange(TextSpan.FromBounds(position, position), typeDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractWhileLoopSnippetProvider.cs (1)
25return new TextChange(TextSpan.FromBounds(position, position), whileStatement.ToFullString());
Wrapping\AbstractCodeActionComputer.cs (2)
91var newSourceText = OriginalSourceText.WithChanges(new TextChange(new TextSpan(nodeOrToken.Span.End, 0), newLine)); 93new TextChange(TextSpan.FromBounds(nodeOrToken.Span.End + newLine.Length, newSourceText.Length), ""));
Microsoft.CodeAnalysis.LanguageServer.Protocol (6)
Extensions\ProtocolConversions.cs (1)
221=> new TextChange(RangeToTextSpan(changeEvent.Range, text), changeEvent.Text);
Handler\InlineCompletions\InlineCompletionsHandler.cs (4)
142var textChange = new TextChange(snippetShortcut, snippetFullText); 173lspTextChanges.Add(new TextChange(fieldInSnippetContext, lspTextForField)); 182lspTextChanges.Add(new TextChange(caretInSnippetContext, "$0")); 217originalSourceText.WithChanges(new TextChange(snippetSpan, parsedSnippet.DefaultText)));
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
208var indentedText = textToIndent.WithChanges(new TextChange(new TextSpan(lineToIndent.End, 0), indentText));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
Completion\CompletionResolveTests.cs (1)
456var textChange = new TextChange(span: new TextSpan(start: 77, length: 9), newText: @"public override void M()
Diagnostics\PullDiagnosticTests.cs (3)
1305var newCsProj2Document = csproj2Document.WithText(csproj2DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj2DocumentText), "B"))); 1380var newCsProj3Document = csproj3Document.WithText(csproj3DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj3DocumentText), "C"))); 1447var newCsProj2Document = csproj2Document.WithText(csproj2DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj2DocumentText), "B")));
Microsoft.CodeAnalysis.UnitTests (156)
Text\SourceTextTests.cs (1)
182var change = new TextChange(span, text.ToString(span));
Text\TextChangeTests.cs (155)
88new TextChange(new TextSpan(0, 5), "Halo"), 89new TextChange(new TextSpan(6, 5), "Universe")); 100new TextChange(new TextSpan(0, 5), "Halo"), 101new TextChange(new TextSpan(3, 5), "Universe") 113new TextChange(new TextSpan(6, 5), "Universe"), 114new TextChange(new TextSpan(0, 5), "Halo") 127new TextChange(new TextSpan(6, 7), "Universe"), 128new TextChange(new TextSpan(0, 5), "Halo") 142new TextChange(new TextSpan(6, 0), "Super "), 143new TextChange(new TextSpan(6, 0), "Spectacular ")); 154new TextChange(new TextSpan(6, 0), "Super "), 155new TextChange(new TextSpan(6, 2), "Vu")); 166new TextChange(new TextSpan(6, 2), "Vu"), 167new TextChange(new TextSpan(6, 0), "Super ") 180new TextChange(new TextSpan(4, 1), string.Empty), 181new TextChange(new TextSpan(5, 1), string.Empty)); 191new TextChange(new TextSpan(4, 1), string.Empty), 192new TextChange(new TextSpan(6, 5), "Universe")); 206new TextChange(new TextSpan(4, 1), string.Empty)); 216new TextChange(new TextSpan(6, 5), "Universe")); 233new TextChange(new TextSpan(0, 1), "[1]"), 234new TextChange(new TextSpan(1, 1), "[2]"), 235new TextChange(new TextSpan(5, 0), "[3]"), 236new TextChange(new TextSpan(25, 2), "[4]") 278new TextChange(new TextSpan(8, 2), "IN"), 279new TextChange(new TextSpan(15, 2), "IN")); 286new TextChange(new TextSpan(8, 2), new string('a', 10)), 287new TextChange(new TextSpan(15, 2), new string('a', 10))); 294new TextChange(new TextSpan(8, 2), "\r\n"), 295new TextChange(new TextSpan(15, 2), "\r\n")); 302new TextChange(new TextSpan(6, 0), "aa\r"), 303new TextChange(new TextSpan(11, 0), "aa\r")); 310new TextChange(new TextSpan(6, 0), "aa\n"), 311new TextChange(new TextSpan(11, 0), "aa\n")); 318new TextChange(new TextSpan(4, 4), "aaaaaa"), 319new TextChange(new TextSpan(15, 4), "aaaaaa")); 326new TextChange(new TextSpan(5, 0), "aaaaaa")); 333new TextChange(new TextSpan(5, 0), "\naaaaaa\r")); 340new TextChange(new TextSpan(21, 0), "Line4\r\n"), 341new TextChange(new TextSpan(21, 0), "Line5\r\n")); 636var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 647var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 648var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), string.Empty)); // this should not cause exception 657var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 658var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 3), "oo")); 672var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 673var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), "bb")); 678Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abba") }, changes); 686var change1 = original.WithChanges(new TextChange(new TextSpan(1, 1), "aaa")); 687var change2 = change1.WithChanges(new TextChange(new TextSpan(3, 0), "bb")); 692Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "aabba") }, changes); 700var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 701var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 1), "bb")); 706Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abb") }, changes); 713var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 714var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 14), "ar")); 727var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 728var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 6), " Bel")); 741var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 742var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 6), "wazy V")); 755var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 756var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 761Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bbaa") }, changes); 768var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 769var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 774Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bbaa") }, changes); 781var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 782var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 787Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bba") }, changes); 794var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 795var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 2), "bb")); 800Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bb") }, changes); 807var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 808var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 813Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "bb") }, changes); 821var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 822var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 827Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bba") }, changes); 835var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 836var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 847var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o ")); 848var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 861var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 862var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 877var change1 = original.WithChanges(new TextChange(new TextSpan(8, 0), "l")); 878var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 893var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), " World")); 895var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 911c => c.WithChanges(new TextChange(new TextSpan(4, 0), "o ")), 912c => c.WithChanges(new TextChange(new TextSpan(6, 0), "World"))); 954Assert.Equal("new TextChange(new TextSpan(0, 1), \"abc\")", new TextChange(new TextSpan(0, 1), "abc").GetDebuggerDisplay()); 955Assert.Equal("new TextChange(new TextSpan(0, 1), (NewLength = 10))", new TextChange(new TextSpan(0, 1), "0123456789").GetDebuggerDisplay()); 979var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText); 999var newChange = new TextChange(new TextSpan(i, length: random.Next(editedLength - i)), newText); 1047var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a")); 1048var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), "bb")); 1061var change1 = original.WithChanges(new TextChange(new TextSpan(0, 0), "aa"), new TextChange(new TextSpan(1, 1), "aa")); 1062var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "")); 1075var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 0), "a")); 1076var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(2, 0), "bb")); 1089var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa"), new TextChange(new TextSpan(3, 1), "aa")); 1090var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "bbb")); 1102var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 3), "a"), new TextChange(new TextSpan(5, 0), "aaa")); 1103var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(3, 1), "bb")); 1116var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aaaaa"), new TextChange(new TextSpan(3, 1), "aaaa"), new TextChange(new TextSpan(6, 1), "aaaaa")); 1117var 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), "")); 1130var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "a")); 1131var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "b")); 1144var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa")); 1145var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "b"), new TextChange(new TextSpan(1, 2), "b")); 1158var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a"), new TextChange(new TextSpan(3, 2), "a")); 1159var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 3), "bbb")); 1172var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 4), ""), new TextChange(new TextSpan(5, 1), "")); 1173var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 0), "")); 1186var 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), "")); 1187var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 1), ""), new TextChange(new TextSpan(2, 0), "")); 1200var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(2, 1), "")); 1201var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), ""), new TextChange(new TextSpan(1, 1), "")); 1226new TextChange(new TextSpan(39, 0), " "), 1227new TextChange(new TextSpan(42, 0), " "), 1228new TextChange(new TextSpan(57, 0), " "), 1229new TextChange(new TextSpan(58, 0), "\r\n"), 1230new TextChange(new TextSpan(64, 2), " "), 1231new TextChange(new TextSpan(69, 0), " "), 1237new TextChange(new TextSpan(35, 4), string.Empty), 1238new TextChange(new TextSpan(46, 4), string.Empty), 1239new TextChange(new TextSpan(73, 4), string.Empty), 1240new TextChange(new TextSpan(88, 0), " "), 1241new TextChange(new TextSpan(90, 4), string.Empty), 1242new TextChange(new TextSpan(105, 4), string.Empty),
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
VisualBasicTriviaFormatter.vb (2)
186changes.Add(New TextChange(trivia.FullSpan, lineContinuation.ToFullString())) 257changes.Add(New TextChange(trivia.FullSpan, docComment.ToFullString()))
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (3)
EndConstructGeneration\ReplaceSpanResult.vb (1)
40subjectBuffer.ApplyChange(New TextChange(_snapshotSpan.TranslateTo(current, SpanTrackingMode.EdgeExclusive).Span.ToTextSpan(), _replacementText))
EndConstructGeneration\SpitLinesResult.vb (1)
52subjectBuffer.ApplyChange(New TextChange(New TextSpan(caretPosition, 0), joinedLines))
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
337subjectBuffer.ApplyChange(New TextChange(New TextSpan(insertPosition, 0), endText))
Microsoft.CodeAnalysis.VisualBasic.Features (8)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (1)
252Dim updatedText = text.WithChanges(New TextChange(TextSpan.FromBounds(insertionPoint, insertionPoint), stringToAppend))
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.MoveToLineCodeAction.vb (2)
38Dim textWithoutLine = text.WithChanges(New TextChange(textLineToMove.SpanIncludingLineBreak, "")) 39Dim textWithMovedLine = textWithoutLine.WithChanges(New TextChange(TextSpan.FromBounds(destinationLineSpan, destinationLineSpan), textLineToMove.ToString().TrimStart() + vbCrLf))
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)
77Return New TextChange(selectedItem.Span, insertionText)
Snippets\VisualBasicSnippetFunctionService.vb (1)
46Dim textChange = New TextChange(caseGenerationLocation, str)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (18)
IncrementalParser\IncrementalParser.vb (18)
91text = text.WithChanges(New TextChange(span, text.ToString(span))) 112Dim newText = text.WithChanges(New TextChange(New TextSpan(text.Length, 0), _s.Substring(i, 1))) 129Dim newText = oldText.WithChanges(New TextChange(New TextSpan(pos, 0), "'")) 138Dim anotherText = newText.WithChanges(New TextChange(New TextSpan(pos, 1), "")) 705Dim newText = oldText.WithChanges(New TextChange(New TextSpan(22, 0), " Sub ")) 744Dim newText = oldText.WithChanges(New TextChange(New TextSpan(103, 0), " ")) 770Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, 0), " ")) 795Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, replace.Length), "{")) 830Dim newText = oldText.WithChanges(New TextChange(New TextSpan(pos, 0), "'")) 1124Dim change = New TextChange(span, "") 1161Dim change = New TextChange(span, code1) 1167change = New TextChange(span, "") 1207Dim change = New TextChange(span, vbCrLf) 1225Dim change = New TextChange(New TextSpan(position, 2), "End" + vbCrLf) 1243Dim change = New TextChange(New TextSpan(position, 0), " Select c" + vbCrLf) 1523New TextChange(TextSpan.FromBounds(8, 8), "System" + vbCrLf + "Imports "), 1524New TextChange(TextSpan.FromBounds(29, 45), "")) 1677Dim change = New TextChange(New TextSpan(position, 2), "71")
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (5)
ParserTestUtilities.vb (4)
259newText = oldText.WithChanges(New TextChange(node.changeSpan, node.changeText)) 261newText = oldText.WithChanges(New TextChange(New TextSpan(0, 0), node.changeText)) 263newText = oldText.WithChanges(New TextChange(node.changeSpan, "")) 265newText = oldText.WithChanges(New TextChange(node.changeSpan, node.changeText))
SyntaxTreeExtensions.vb (1)
18Dim newFullText = oldFullText.WithChanges(New TextChange(New TextSpan(offset, length), newText))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (5)
Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
186changes.Add(New TextChange(trivia.FullSpan, lineContinuation.ToFullString())) 257changes.Add(New TextChange(trivia.FullSpan, docComment.ToFullString()))
OrganizeImports\VisualBasicOrganizeImportsService.Rewriter.vb (2)
55Me.TextChanges.Add(New TextChange(GetTextSpan(list), GetNewText(organizedList))) 62Me.TextChanges.Add(New TextChange(GetTextSpan(list), GetNewText(organizedList)))
Microsoft.CodeAnalysis.Workspaces (9)
AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
54=> SpecializedCollections.SingletonEnumerable<TextChange>(new TextChange(textSpan, _newString));
AbstractTriviaFormatter.cs (2)
824=> new(span, GetWhitespaceString(lineColumn, delta)); 829changes.Add(new TextChange(span, newText));
FormattingExtensions.cs (1)
282return new TextChange(span, newText);
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (2)
77var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText)); 87commentChanges.Add(new TextChange(TextSpan.FromBounds(startLineStartPosition, startLineStartPosition), warningText));
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (2)
261combinedChanges.Add(new TextChange(conflictingCommentInsertionLocation, commentChangesList[commentChangeIndex].NewText)); 304currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
44var 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)
547var newText = existingText.WithChanges(new TextChange(new TextSpan(existingText.Length, length: 0), " With Change"));
SymbolKeyTests.cs (3)
803var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 850var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 1348var 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 (5)
Implementation\AbstractEditorFactory.cs (1)
369formattedText = formattedText.WithChanges(new TextChange(currentSpan, targetLineEnding));
Venus\ContainedDocument.cs (4)
525textChange = new TextChange(spanInOriginalText, snippetInRightText); 550textChange = new TextChange( 571textChange = new TextChange( 588textChange = new TextChange(
Microsoft.VisualStudio.LanguageServices.UnitTests (7)
Completion\MockCompletionProvider.vb (1)
27Return Task.FromResult(Of TextChange?)(New TextChange(selectedItem.Span, "InsertionText"))
Preview\PreviewChangesTests.vb (6)
42Dim textChange = New TextChange(New TextSpan(workspace.Documents.First().CursorPosition.Value, 0), "insertion!") 96Dim textChange = New TextChange(New TextSpan(workspace.Documents.First().CursorPosition.Value, 0), "insertion!") 139Dim textChange = New TextChange(New TextSpan(workspace.Documents.First().CursorPosition.Value, 0), "insertion!") 193Dim textChange = New TextChange(New TextSpan(workspace.Documents.First().CursorPosition.Value, 0), "insertion!") 280Dim textChange1 = New TextChange(New TextSpan(19, 1), "N") 283Dim textChange2 = New TextChange(New TextSpan(47, 1), "Y")
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
Snippets\SnippetCommandHandler.vb (1)
120subjectBuffer.ApplyChange(New TextChange(Microsoft.CodeAnalysis.Text.TextSpan.FromBounds(caretPosition - 1, caretPosition), String.Empty))
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Features\InlineRename\XamlEditorInlineRenameService.cs (1)
165var newSource = oldSource.WithChanges(group.Select(l => new TextChange(l.TextSpan, replacementText)));
Roslyn.VisualStudio.Next.UnitTests (2)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
56var newText = oldText.WithChanges(new[] { new TextChange(new TextSpan(0, 1), "abc") });
Services\ServiceHubServicesTests.cs (1)
84var newText = oldText.WithChanges(new TextChange(TextSpan.FromBounds(0, 0), "/* test */"));
678 references to TextChange
Microsoft.CodeAnalysis (29)
InternalUtilities\TextChangeRangeExtensions.cs (1)
102public static TextChangeRange ToTextChangeRange(this TextChange textChange)
Syntax\SyntaxDiffer.cs (4)
37internal static IList<TextChange> GetTextChanges(SyntaxTree before, SyntaxTree after) 41return SpecializedCollections.EmptyList<TextChange>(); 58internal static IList<TextChange> GetTextChanges(SyntaxNode oldNode, SyntaxNode newNode) 63private IList<TextChange> ComputeTextChangesFromOld()
Syntax\SyntaxTree.cs (1)
351public abstract IList<TextChange> GetChanges(SyntaxTree oldTree);
Text\ChangedText.cs (1)
153public override SourceText WithChanges(IEnumerable<TextChange> changes)
Text\SourceText.cs (8)
638public virtual SourceText WithChanges(IEnumerable<TextChange> changes) 656foreach (var change in changes) 736/// Changes do not have to be in sorted order. However, <see cref="WithChanges(IEnumerable{TextChange})"/> will 741public SourceText WithChanges(params TextChange[] changes) 743return this.WithChanges((IEnumerable<TextChange>)changes); 785/// Gets the set of <see cref="TextChange"/> that describe how the text changed 789public virtual IReadOnlyList<TextChange> GetTextChanges(SourceText oldText) 794var textChanges = new List<TextChange>(ranges.Count);
Text\TextChange.cs (14)
18public readonly struct TextChange : IEquatable<TextChange> 33/// Initializes a new instance of <see cref="TextChange"/> 50/// Provides a string representation for <see cref="TextChange"/>. 59return obj is TextChange && this.Equals((TextChange)obj); 62public bool Equals(TextChange other) 74public static bool operator ==(TextChange left, TextChange right) 79public static bool operator !=(TextChange left, TextChange right) 85/// Converts a <see cref="TextChange"/> to a <see cref="TextChangeRange"/>. 88public static implicit operator TextChangeRange(TextChange change) 97public static IReadOnlyList<TextChange> NoChanges => SpecializedCollections.EmptyReadOnlyList<TextChange>();
Microsoft.CodeAnalysis.CodeStyle (37)
AbstractAggregatedFormattingResult.cs (6)
24private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 39_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 61public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 67private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 81private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 90var result = new List<TextChange>(count);
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))
AbstractTriviaDataFactory.FormattedWhitespace.cs (2)
53public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan) 54=> SpecializedCollections.SingletonEnumerable<TextChange>(new TextChange(textSpan, _newString));
AbstractTriviaDataFactory.Whitespace.cs (1)
90public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
AbstractTriviaFormatter.cs (11)
190protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 266public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 268using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 281return ImmutableArray<TextChange>.Empty; 675private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 703var change = GetWhitespaceTextChange( 713private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 720var change = changes[i]; 731private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 823private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 826private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
FormatterHelper.cs (2)
52internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan> spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 65public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken)
FormattingAnalyzerHelper.cs (2)
30foreach (var formattingChange in formattingChanges) 32var change = formattingChange;
FormattingExtensions.cs (2)
255public static TextChange SimpleDiff(this TextChange textChange, string text)
IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
ISmartTokenFormatter.cs (1)
14IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
TextChangeRangeExtensions.cs (1)
102public static TextChangeRange ToTextChangeRange(this TextChange textChange)
TriviaData.cs (1)
41public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
Microsoft.CodeAnalysis.CodeStyle.Fixes (10)
AbstractConflictMarkerCodeFixProvider.cs (6)
302Action<SourceText, ArrayBuilder<TextChange>, int, int, int, int> addEdits, 307using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 315SourceText text, ArrayBuilder<TextChange> edits, 328SourceText text, ArrayBuilder<TextChange> edits, 341SourceText text, ArrayBuilder<TextChange> edits, 398using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits);
ParsedDocument.cs (4)
62public ParsedDocument WithChange(TextChange change, CancellationToken cancellationToken) 65public ParsedDocument WithChanges(IEnumerable<TextChange> changes, CancellationToken cancellationToken) 71public IEnumerable<TextChange> GetChanges(in ParsedDocument oldDocument) 77return SpecializedCollections.EmptyEnumerable<TextChange>();
Microsoft.CodeAnalysis.CSharp (1)
Syntax\CSharpSyntaxTree.cs (1)
612public override IList<TextChange> GetChanges(SyntaxTree oldTree)
Microsoft.CodeAnalysis.CSharp.CodeStyle (9)
CSharpSmartTokenFormatter.cs (3)
45public IList<TextChange> FormatRange( 78public IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken) 87return SpecializedCollections.EmptyList<TextChange>();
CSharpTriviaFormatter.cs (2)
260LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken) 351LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken)
TriviaDataFactory.ComplexTrivia.cs (1)
106public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaDataFactory.FormattedComplexTrivia.cs (2)
19private readonly IList<TextChange> _textChanges; 58public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaDataFactory.ModifiedComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
ArrowExpressionClausePlacementCodeFixProvider.cs (2)
54using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 74ArrayBuilder<TextChange> edits)
ConditionalExpressionPlacementCodeFixProvider.cs (2)
54using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 75ArrayBuilder<TextChange> edits)
ConvertNamespaceTransform.cs (2)
129using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 137private static TextChange? TryDedentLine(
Microsoft.CodeAnalysis.CSharp.EditorFeatures (33)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (3)
100protected override IList<TextChange> FormatBasedOnEndToken(ParsedDocument document, int position, SyntaxFormattingOptions options, CancellationToken cancellationToken) 107return SpecializedCollections.EmptyList<TextChange>(); 658var insertChange = new TextChange(new TextSpan(insertionPosition, 0), bracePair);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
208var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
Formatting\CSharpFormattingInteractionService.cs (6)
88public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync( 103public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken) 111public Task<ImmutableArray<TextChange>> GetFormattingChangesOnReturnAsync(Document document, int caretPosition, CancellationToken cancellationToken) 112=> SpecializedTasks.EmptyImmutableArray<TextChange>(); 114public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, char typedChar, int position, CancellationToken cancellationToken) 125return SpecializedTasks.EmptyImmutableArray<TextChange>();
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (4)
58if (textChangeOpt is not TextChange textChange) 83private static TextChange? TryGenerateInitialEmptyRawString( 130private static TextChange? TryGrowInitialEmptyRawString( 186private static TextChange? TryGrowRawStringDelimeters(
StringCopyPaste\AbstractPasteProcessor.cs (1)
129public abstract ImmutableArray<TextChange> GetEdits();
StringCopyPaste\KnownSourcePasteProcessor.cs (8)
62public override ImmutableArray<TextChange> GetEdits() 83private ImmutableArray<TextChange> GetEditsForNonRawString() 134private ImmutableArray<TextChange> GetEditsForRawString() 172var trivialContentEdit = GetContentEditForRawString(insertInterpolations: false, dollarSignCount: -1); 191private ImmutableArray<TextChange> DetermineTotalEditsToMakeToRawString( 197using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 236ArrayBuilder<TextChange> edits, bool beforeSelection, int dollarSignsToAdd) 256private TextChange GetContentEditForRawString(
StringCopyPaste\StringCopyPasteCommandHandler.cs (3)
190foreach (var change in textChanges) 198ImmutableArray<TextChange> GetEdits(CancellationToken cancellationToken) 221ImmutableArray<TextChange> TryGetEditsFromKnownCopySource(
StringCopyPaste\UnknownSourcePasteProcessor.cs (7)
52public override ImmutableArray<TextChange> GetEdits() 94private ImmutableArray<TextChange> GetEditsForNonRawString() 96using var textChanges = TemporaryArray<TextChange>.Empty; 110private ImmutableArray<TextChange> GetEditsForRawString() 129using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 163private void AdjustWhitespaceAndAddTextChangesForSingleLineRawStringLiteral(ArrayBuilder<TextChange> edits) 236ArrayBuilder<TextChange> edits)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (8)
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (1)
3089var change = commit.TextChange;
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (3)
336var update = Assert.Single(updates); 359var update = Assert.Single(updates); 392var update = Assert.Single(updates);
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (2)
3452private static string GetFormattedText(ITextBuffer buffer, IList<TextChange> changes) 3456foreach (var change in changes)
Intents\IntentTestsBase.cs (1)
77foreach (var change in documentChange.Value)
StringIndentation\StringIndentationTests.cs (1)
44using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes);
Microsoft.CodeAnalysis.CSharp.Features (28)
ArrowExpressionClausePlacementCodeFixProvider.cs (2)
54using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 74ArrayBuilder<TextChange> edits)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (7)
114TextChange? newLineEdit = null; 169static ImmutableArray<TextChange> GetMergedChanges(TextChange? newLineEdit, ImmutableArray<TextChange> formattingChanges, SourceText formattedText) 186using var _ = ArrayBuilder<TextChange>.GetInstance(out var mergedChanges); 212private (SyntaxNode formattedRoot, ImmutableArray<TextChange> textChanges, int finalBraceEnd) FormatTrackingSpan( 252return (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\CrefCompletionProvider.cs (2)
381protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 388return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.cs (2)
127public override Task<TextChange?> GetTextChangeAsync( 133return Task.FromResult<TextChange?>(new TextChange(
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (2)
283protected override Task<TextChange?> GetTextChangeAsync(CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 285return Task.FromResult<TextChange?>(new TextChange(
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (1)
87using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder);
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
143var 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(
ConditionalExpressionPlacementCodeFixProvider.cs (2)
54using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 75ArrayBuilder<TextChange> edits)
ConvertNamespaceTransform.cs (2)
129using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 137private static TextChange? TryDedentLine(
Snippets\CSharpElseSnippetProvider.cs (1)
66protected override Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\CSharpSnippetFunctionService.cs (1)
59var textChange = new TextChange(caseGenerationLocation, str);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\BindingAwaitTests.cs (1)
28TextChange change = new TextChange(span, "/*comment*/");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Metadata\MetadataTypeTests.cs (1)
364var change = new TextChange(span, text1);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (27)
IncrementalParsing\IncrementalParsingTests.cs (27)
2526var change = new TextChange(span, text1); 2609var change = new TextChange(span, "// "); 2646var change = new TextChange(span, "// "); 2725var change = new TextChange(new TextSpan(0, 0), items[1]); // Prepend 2824var change = new TextChange(span, "p"); 2845var change = new TextChange(span, ""); 2866var change = new TextChange(span, "["); 2887var change = new TextChange(span, "[Obsolete]"); 2908var change = new TextChange(span, "public"); 2930var change = new TextChange(span, "c"); 2954var change = new TextChange(span, "1, Attr2"); 2978var change = new TextChange(span, ", Attr2"); 3002var change = new TextChange(span, " [Attr2]"); 3026var change = new TextChange(span, "Arg"); 3050var change = new TextChange(span, "2"); 3076var change = new TextChange(span, "1, Attr2"); 3101var change = new TextChange(span, "[Attr]"); 3127var change = new TextChange(span, " [Attr2]"); 3153var change = new TextChange(span, ""); 3171var change = new TextChange(span, ".z"); 3189var change = new TextChange(span, " if (c) { }"); 3207var change = new TextChange(span, " else (c) { }"); 3221var change = new TextChange(span, ""); 3235var change = new TextChange(span, "{ "); 3250var change = new TextChange(span, ""); 3287var change = new TextChange(span, "["); 3315new TextChange[] {
Microsoft.CodeAnalysis.CSharp.Workspaces (18)
CSharpSmartTokenFormatter.cs (3)
45public IList<TextChange> FormatRange( 78public IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken) 87return SpecializedCollections.EmptyList<TextChange>();
CSharpTriviaFormatter.cs (2)
260LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken) 351LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken)
Formatting\CSharpSyntaxFormattingService.cs (7)
93public ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter( 169private static IList<TextChange> FormatToken( 176private static ImmutableArray<TextChange> FormatRange( 185return ImmutableArray<TextChange>.Empty; 191return ImmutableArray<TextChange>.Empty; 196return ImmutableArray<TextChange>.Empty; 325public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken)
OrganizeImports\CSharpOrganizeImportsService.Rewriter.cs (2)
24public readonly IList<TextChange> TextChanges = new List<TextChange>();
TriviaDataFactory.ComplexTrivia.cs (1)
106public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaDataFactory.FormattedComplexTrivia.cs (2)
19private readonly IList<TextChange> _textChanges; 58public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaDataFactory.ModifiedComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
Microsoft.CodeAnalysis.EditorFeatures (70)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (2)
54protected abstract IList<TextChange> FormatBasedOnEndToken(ParsedDocument document, int position, SyntaxFormattingOptions formattingOptions, CancellationToken cancellationToken); 206var insertChange = new TextChange(new TextSpan(insertPosition, 0), endingString);
AutomaticCompletion\BraceCompletionSessionProvider.BraceCompletionSession.cs (1)
424foreach (var change in result.TextChanges)
CommentSelection\AbstractCommentSelectionBase.cs (2)
82protected static void InsertText(ArrayBuilder<TextChange> textChanges, int position, string text) 85protected static void DeleteText(ArrayBuilder<TextChange> textChanges, TextSpan span)
CommentSelection\AbstractToggleBlockCommentBase.cs (7)
35new(new List<TextChange>(), new List<CommentTrackingSpan>(), Operation.Uncomment); 109var textChanges = ArrayBuilder<TextChange>.GetInstance(); 136BlockCommentSelectionHelper blockCommentSelection, ArrayBuilder<TextChange> textChanges, 167ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans, CommentSelectionInfo commentInfo) 221ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans, CommentSelectionInfo commentInfo) 257private static void AddBlockComment(CommentSelectionInfo commentInfo, TextSpan span, ArrayBuilder<TextChange> textChanges) 264ArrayBuilder<TextChange> textChanges, CommentSelectionInfo commentInfo)
CommentSelection\CommentSelectionResult.cs (2)
18public ImmutableArray<TextChange> TextChanges { get; } 30public CommentSelectionResult(IEnumerable<TextChange> textChanges, IEnumerable<CommentTrackingSpan> trackingSpans, Operation resultOperation)
CommentSelection\CommentUncommentSelectionCommandHandler.cs (10)
87var textChanges = ArrayBuilder<TextChange>.GetInstance(); 108ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans) 170private static void AddSingleLineComments(SnapshotSpan span, ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans, ITextSnapshotLine firstLine, ITextSnapshotLine lastLine, CommentSelectionInfo commentInfo) 179private static void AddBlockComment(SnapshotSpan span, ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> trackingSpans, CommentSelectionInfo commentInfo) 191ArrayBuilder<TextChange> textChanges, ArrayBuilder<CommentTrackingSpan> spansToSelect) 219private static bool TryUncommentExactlyBlockComment(CommentSelectionInfo info, SnapshotSpan span, ArrayBuilder<TextChange> textChanges, 237private static void UncommentContainingBlockComment(CommentSelectionInfo info, SnapshotSpan span, ArrayBuilder<TextChange> textChanges, 265private static void UncommentPosition(CommentSelectionInfo info, ArrayBuilder<TextChange> textChanges, 278private static bool TryUncommentSingleLineComments(CommentSelectionInfo info, SnapshotSpan span, ArrayBuilder<TextChange> textChanges, 310CommentSelectionInfo info, ArrayBuilder<TextChange> textChanges, ITextSnapshotLine firstLine, ITextSnapshotLine lastLine, int indentToCommentAt)
CommentSelection\ToggleLineCommentCommandHandler.cs (4)
41new(new List<TextChange>(), new List<CommentTrackingSpan>(), Operation.Uncomment); 87var textChanges = ArrayBuilder<TextChange>.GetInstance(); 123ArrayBuilder<TextChange> textChanges, 145ArrayBuilder<TextChange> textChanges,
Editor\IContainedDocument.cs (1)
16public ITextSnapshot ApplyChanges(IEnumerable<TextChange> changes);
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (1)
107var 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)
50public ImmutableArray<TextChange> PriorTextEdits { get; } 58public IntentRequestContext(string intentName, SnapshotSpan currentSnapshotSpan, ImmutableArray<TextChange> textEditsToPrior, TextSpan priorSelection, string? intentData) 81public readonly ImmutableDictionary<DocumentId, ImmutableArray<TextChange>> DocumentChanges; 90public IntentSource(string title, string actionName, ImmutableDictionary<DocumentId, ImmutableArray<TextChange>> documentChanges)
ExternalAccess\IntelliCode\IntentProcessor.cs (2)
110using var _ = PooledDictionary<DocumentId, ImmutableArray<TextChange>>.GetInstance(out var results); 124private static async Task<ImmutableArray<TextChange>?> GetTextChangesForDocumentAsync(
ExternalAccess\UnitTestGenerator\Api\WrappedAddImportFixData.cs (1)
25public ImmutableArray<TextChange> TextChanges => Underlying.TextChanges;
ExternalAccess\VSTypeScript\Api\IVSTypeScriptFormattingInteractionService.cs (4)
33Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, DocumentOptionSet? documentOptions, CancellationToken cancellationToken); 38Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, DocumentOptionSet? documentOptions, CancellationToken cancellationToken); 45Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, char typedChar, int position, DocumentOptionSet? documentOptions, CancellationToken cancellationToken); 50Task<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)
39public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken) 42public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken) 45public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, char typedChar, int position, CancellationToken cancellationToken) 48public Task<ImmutableArray<TextChange>> GetFormattingChangesOnReturnAsync(Document document, int position, CancellationToken cancellationToken)
ExtractMethod\ExtractMethodCommandHandler.cs (1)
213ITextBuffer textBuffer, IEnumerable<TextChange> changes, IBackgroundWorkIndicatorContext waitContext)
Formatting\FormatCommandHandler.cs (1)
150IList<TextChange>? textChanges;
Formatting\IFormattingInteractionService.cs (4)
32Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken); 37Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken); 44Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, char typedChar, int position, CancellationToken cancellationToken); 49Task<ImmutableArray<TextChange>> GetFormattingChangesOnReturnAsync(Document document, int position, CancellationToken cancellationToken);
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (5)
343foreach (var change in changes) 540private static async Task<IEnumerable<TextChange>> GetTextChangesFromTextDifferencingServiceAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken = default) 549return SpecializedCollections.EmptyEnumerable<TextChange>(); 562return SpecializedCollections.EmptyEnumerable<TextChange>(); 618foreach (var change in textDiffService.GetTextChangesAsync(preMergeDocument, postMergeDocument, cancellationToken).WaitAndGetResult(cancellationToken))
IntelliSense\AsyncCompletion\CommitManager.cs (1)
233var textChange = change.TextChange;
Interactive\InteractiveWorkspace.cs (1)
65foreach (var change in changes)
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
185var 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)
32internal static void ApplyTextChanges(this Workspace workspace, DocumentId id, IEnumerable<TextChange> textChanges, CancellationToken cancellationToken) 39private static Solution UpdateDocument(this Solution solution, DocumentId id, IEnumerable<TextChange> textChanges, CancellationToken cancellationToken)
TextDiffing\EditorTextDifferencingService.cs (2)
32public Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken) 35public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.EditorFeatures.Cocoa (2)
Snippets\CSharpSnippets\SnippetFunctions\SnippetFunctionGenerateSwitchCases.cs (1)
82var textChange = new TextChange(new TextSpan(startPosition, endPosition - startPosition), str);
Snippets\SnippetFunctions\AbstractSnippetFunctionSimpleTypeName.cs (1)
69var textChange = new TextChange(originalTextSpan, _fullyQualifiedName);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (8)
Completion\AbstractCompletionProviderTests.cs (2)
600var textChange = (await service.GetChangeAsync(document, firstItem, commitChar, CancellationToken.None)).TextChange; 613var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString());
Formatting\CoreFormatterTestsBase.cs (2)
163private static string ApplyResultAndGetFormattedText(ITextBuffer buffer, IList<TextChange> changes) 167foreach (var change in changes)
LanguageServer\AbstractLanguageServerProtocolTests.cs (1)
93public Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync(
Workspaces\TestFormattingRuleFactoryServiceFactory.cs (2)
54public IEnumerable<TextChange> FilterFormattedChanges(DocumentId document, TextSpan span, IList<TextChange> changes)
Workspaces\TestHostDocument.cs (1)
331foreach (var change in changes)
Microsoft.CodeAnalysis.EditorFeatures.Text (2)
Extensions.SnapshotSourceText.cs (2)
186public override SourceText WithChanges(IEnumerable<TextChange> changes) 213foreach (var change in changes)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (14)
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (11)
80CommentSelection(code, Enumerable.Empty<TextChange>(), supportBlockComments: true); 94CommentSelection(code, Enumerable.Empty<TextChange>(), supportBlockComments: true); 486UncommentSelection(code, Enumerable.Empty<TextChange>(), new Span(17, 0), supportBlockComments: true); 493UncommentSelection(code, Enumerable.Empty<TextChange>(), new Span(8, 0), supportBlockComments: true); 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 (2)
69var expectedChange = new TextChange(item.Span, nameof(DebugAssertTestCompletionProvider)); 70var actualChange = (await completionService.GetChangeAsync(document, item).ConfigureAwait(false)).TextChange;
Snippets\RoslynLSPSnippetConvertTests.cs (1)
495var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length));
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
InlineHints\InlineHintsTag.cs (1)
280var textChange = _hint.ReplacementTextChange!.Value;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
InlineHints\AbstractInlineHintsTests.vb (1)
61Dim textChanges = New List(Of TextChange)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (19)
Completion\IFSharpCommonCompletionProvider.cs (2)
21public abstract Task<TextChange?> GetTextChangeAsync( 22Func<CompletionItem, char?, CancellationToken, Task<TextChange?>> baseGetTextChangeAsync,
Editor\IFSharpEditorFormattingService.cs (4)
30Task<IList<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, CancellationToken cancellationToken); 35Task<IList<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 42Task<IList<TextChange>?> GetFormattingChangesAsync(Document document, char typedChar, int position, CancellationToken cancellationToken); 47Task<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 (12)
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) 82return changes?.ToImmutableArray() ?? ImmutableArray<TextChange>.Empty; 85async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, char typedChar, int position, CancellationToken cancellationToken) 88return changes?.ToImmutableArray() ?? ImmutableArray<TextChange>.Empty; 91async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken) 94return changes?.ToImmutableArray() ?? ImmutableArray<TextChange>.Empty; 97async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesOnReturnAsync(Document document, int position, CancellationToken cancellationToken) 100return changes?.ToImmutableArray() ?? ImmutableArray<TextChange>.Empty;
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (2)
InlineHints\OmniSharpInlineHintsService.cs (2)
38TextChange? replacementTextChange, 49public readonly TextChange? ReplacementTextChange { get; }
Microsoft.CodeAnalysis.ExternalAccess.Razor (4)
RazorCSharpFormattingInteractionService.cs (3)
32public static async Task<ImmutableArray<TextChange>> GetFormattingChangesAsync( 47return ImmutableArray<TextChange>.Empty; 60public static IList<TextChange> GetFormattedTextChanges(
RazorSpanMappingServiceWrapper.cs (1)
31public override async Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync(
Microsoft.CodeAnalysis.Features (115)
AbstractConflictMarkerCodeFixProvider.cs (6)
302Action<SourceText, ArrayBuilder<TextChange>, int, int, int, int> addEdits, 307using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits); 315SourceText text, ArrayBuilder<TextChange> edits, 328SourceText text, ArrayBuilder<TextChange> edits, 341SourceText text, ArrayBuilder<TextChange> edits, 398using var _ = ArrayBuilder<TextChange>.GetInstance(out var edits);
AddImport\AddImportFixData.cs (6)
29public readonly ImmutableArray<TextChange> TextChanges; 104ImmutableArray<TextChange> textChanges, 132public static AddImportFixData CreateForProjectSymbol(ImmutableArray<TextChange> textChanges, string title, ImmutableArray<string> tags, CodeActionPriority priority, ProjectId projectReferenceToAdd) 140public static AddImportFixData CreateForMetadataSymbol(ImmutableArray<TextChange> textChanges, string title, ImmutableArray<string> tags, CodeActionPriority priority, ProjectId portableExecutableReferenceProjectId, string portableExecutableReferenceFilePathToAdd) 149public static AddImportFixData CreateForReferenceAssemblySymbol(ImmutableArray<TextChange> textChanges, string title, string assemblyReferenceAssemblyName, string assemblyReferenceFullyQualifiedTypeName) 158public static AddImportFixData CreateForPackageSymbol(ImmutableArray<TextChange> textChanges, string packageSource, string packageName, string packageVersionOpt)
AddImport\CodeActions\AddImportCodeAction.cs (1)
42private readonly ImmutableArray<TextChange> _textChanges;
AddImport\References\MetadataSymbolReference.cs (1)
59Document document, ImmutableArray<TextChange> textChanges, string description,
AddImport\References\ProjectSymbolReference.cs (1)
83Document document, ImmutableArray<TextChange> textChanges, string description,
AddImport\References\Reference.cs (1)
107protected async Task<ImmutableArray<TextChange>> GetTextChangesAsync(
AddImport\References\SymbolReference.cs (3)
54private async Task<ImmutableArray<TextChange>> GetTextChangesAsync( 62return ImmutableArray<TextChange>.Empty; 125Document document, ImmutableArray<TextChange> textChanges,
BraceCompletion\AbstractBraceCompletionService.cs (1)
64var braceTextEdit = new TextChange(TextSpan.FromBounds(closingPoint, closingPoint), ClosingBrace.ToString());
BraceCompletion\IBraceCompletionService.cs (2)
81public ImmutableArray<TextChange> TextChanges { get; } 93public BraceCompletionResult(ImmutableArray<TextChange> textChanges, LinePosition caretLocation)
CodeFixes\Configuration\ConfigurationUpdater.cs (4)
464var textChange = new TextChange(); 737var textChange = new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry); 747var textChange = new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry); 785var textChange = new TextChange(new TextSpan(result.Length, 0), prefix + newEntry);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (6)
120private static async Task<IEnumerable<TextChange>> GetTextChangesAsync( 131private static void UpdateDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics, Dictionary<Diagnostic, TextSpan> currentDiagnosticSpans, IEnumerable<TextChange> textChanges) 133static bool IsPriorSpan(TextSpan span, TextChange textChange) => span.End <= textChange.Span.Start; 134static bool IsFollowingSpan(TextSpan span, TextChange textChange) => span.Start >= textChange.Span.End; 135static bool IsEnclosingSpan(TextSpan span, TextChange textChange) => span.Contains(textChange.Span); 147foreach (var textChange in textChanges)
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (2)
104var allTextChanges = new HashSet<TextChange>(); 195private static async Task<(ProjectChanges, IEnumerable<TextChange>)> GetChangesForCodeActionAsync(
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 (16)
22public TextChange TextChange { get; } 29public ImmutableArray<TextChange> TextChanges { get; } 47TextChange textChange, ImmutableArray<TextChange> textChanges, int? newPosition, bool includesCommitCharacter) 53TextChange textChange, ImmutableArray<TextChange> textChanges, int? newPosition, bool includesCommitCharacter, ImmutableDictionary<string, string> properties) 75/// are multiple entries, <see cref="Create(TextChange, ImmutableArray{TextChange}, int?, bool)"/> must be called instead, 80ImmutableArray<TextChange> textChanges, 90TextChange textChange, 102TextChange textChange, 103ImmutableArray<TextChange> textChanges, 111TextChange textChange, 112ImmutableArray<TextChange> textChanges, 123public CompletionChange WithTextChange(TextChange textChange) 129public CompletionChange WithTextChanges(ImmutableArray<TextChange> textChanges)
Completion\Providers\AbstractAwaitCompletionProvider.cs (1)
166using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder);
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 (1)
69var change = Utilities.Collapse(newText, changesArray);
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (2)
115public override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 118return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\Providers\AbstractSymbolCompletionProvider.cs (2)
377public sealed override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem selectedItem, char? ch, CancellationToken cancellationToken) 378=> Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, GetInsertionText(selectedItem, ch)));
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (2)
147using var _ = ArrayBuilder<TextChange>.GetInstance(out var builder); 172var change = Utilities.Collapse(newText, changes);
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (2)
47var change = Utilities.Collapse(allChangesText, allTextChanges.AsImmutable()); 130var textChange = new TextChange(span, string.Empty);
Completion\Utilities.cs (2)
18public static TextChange Collapse(SourceText newText, ImmutableArray<TextChange> changes)
ConvertTupleToStruct\IRemoteConvertTupleToStructCodeRefactoringService.cs (2)
55public readonly ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> DocumentTextChanges; 61ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> documentTextChanges,
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
110var textChange = embeddedItem.Change.TextChange;
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (1)
101var textChange = change.TextChange;
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
118var result = await client.TryInvokeAsync<IRemoteEncapsulateFieldService, ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>>(
EncapsulateField\IRemoteEncapsulateFieldService.cs (1)
28ValueTask<ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>> EncapsulateFieldsAsync(
FormatterHelper.cs (2)
52internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan> spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 65public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken)
FormattingAnalyzerHelper.cs (2)
30foreach (var formattingChange in formattingChanges) 32var change = formattingChange;
FullyQualify\AbstractFullyQualifyService.cs (1)
218private async Task<IEnumerable<TextChange>> ProcessNodeAsync(Document document, TSimpleNameSyntax simpleName, string containerName, INamespaceOrTypeSymbol originalSymbol, CancellationToken cancellationToken)
FullyQualify\IFullyQualifyService.cs (2)
36public readonly ImmutableArray<TextChange> TextChanges; 38public FullyQualifyIndividualFixData(string title, ImmutableArray<TextChange> textChanges)
InlineHints\InlineHint.cs (3)
18public readonly TextChange? ReplacementTextChange; 33TextChange? replacementTextChange, 42TextChange? replacementTextChange,
InlineHints\TypeHint.cs (3)
17public TextChange? TextChange { get; } 21public TypeHint(ITypeSymbol type, TextSpan span, TextChange? textChange, bool leadingSpace = false, bool trailingSpace = false) 33public void Deconstruct(out ITypeSymbol type, out TextSpan span, out TextChange? textChange, out ImmutableArray<SymbolDisplayPart> prefix, out ImmutableArray<SymbolDisplayPart> suffix)
Snippets\RoslynLSPSnippetConverter.cs (7)
25public static async Task<string> GenerateLSPSnippetAsync(Document document, int caretPosition, ImmutableArray<SnippetPlaceholder> placeholders, TextChange textChange, int triggerLocation, CancellationToken cancellationToken) 27var extendedTextChange = await ExtendSnippetTextChangeAsync(document, textChange, placeholders, caretPosition, triggerLocation, cancellationToken).ConfigureAwait(false); 35private static string ConvertToLSPSnippetString(TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition) 111private static async Task<TextChange> ExtendSnippetTextChangeAsync(Document document, TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition, int triggerLocation, CancellationToken cancellationToken) 116var newTextChange = new TextChange(extendedSpan, newString); 126private static TextSpan GetUpdatedTextSpan(TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition, int triggerLocation)
Snippets\SnippetChange.cs (2)
20public readonly ImmutableArray<TextChange> TextChanges; 34ImmutableArray<TextChange> textChanges,
Snippets\SnippetFunctionService.cs (1)
43var textChange = new TextChange(fieldSpan, fullyQualifiedTypeName);
Snippets\SnippetProviders\AbstractConditionalBlockSnippetProvider.cs (3)
21protected abstract TextChange GenerateSnippetTextChange(Document document, int position); 24protected override Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken) 26var snippetTextChange = GenerateSnippetTextChange(document, position);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (3)
48protected override async Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken) 50var snippetTextChange = await GenerateSnippetTextChangeAsync(document, position, cancellationToken).ConfigureAwait(false); 59private async Task<TextChange> GenerateSnippetTextChangeAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractConstructorSnippetProvider.cs (1)
31protected override async Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractForEachLoopSnippetProvider.cs (2)
32protected override async Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken) 35var snippetTextChange = new TextChange(TextSpan.FromBounds(position, position), forEachStatementSyntax.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractIfSnippetProvider.cs (1)
24protected override TextChange GenerateSnippetTextChange(Document document, int position)
Snippets\SnippetProviders\AbstractPropertySnippetProvider.cs (1)
23protected override async Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractSnippetProvider.cs (2)
43protected abstract Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken); 208private static async Task<Document> GetDocumentWithSnippetAsync(Document document, ImmutableArray<TextChange> snippets, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (2)
21protected override async Task<ImmutableArray<TextChange>> GenerateSnippetTextChangesAsync(Document document, int position, CancellationToken cancellationToken) 28var snippetTextChange = new TextChange(TextSpan.FromBounds(position, position), typeDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractWhileLoopSnippetProvider.cs (1)
20protected override TextChange GenerateSnippetTextChange(Document document, int position)
Microsoft.CodeAnalysis.LanguageServer.Protocol (14)
Extensions\ProtocolConversions.cs (5)
210public static LSP.TextEdit TextChangeToTextEdit(TextChange textChange, SourceText oldText) 220public static TextChange ContentChangeEventToTextChange(LSP.TextDocumentContentChangeEvent changeEvent, SourceText text) 268ImmutableArray<TextChange> textChanges; 288foreach (var textChange in textChanges) 299var textChange = textChanges[i];
Handler\CodeActions\CodeActionResolveHandler.cs (1)
186IEnumerable<TextChange> textChanges;
Handler\InlineCompletions\InlineCompletionsHandler.cs (4)
142var textChange = new TextChange(snippetShortcut, snippetFullText); 150?.ToImmutableArray() ?? ImmutableArray<TextChange>.Empty; 164using var _1 = ArrayBuilder<TextChange>.GetInstance(out var lspTextChanges); 190static TextSpan GetAdjustedSpan(ImmutableArray<TextChange> textChanges, TextSpan originalSpan)
Handler\OnAutoInsert\OnAutoInsertHandler.cs (4)
183var textChange = await GetCollapsedChangeAsync(textChanges, document, cancellationToken).ConfigureAwait(false); 212static async Task<TextChange> GetCollapsedChangeAsync(ImmutableArray<TextChange> textChanges, Document oldDocument, CancellationToken cancellationToken) 219static string GetTextChangeTextWithCaretAtLocation(SourceText sourceText, TextChange textChange, LinePosition desiredCaretLinePosition)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Completion\CompletionResolveTests.cs (1)
456var textChange = new TextChange(span: new TextSpan(start: 77, length: 9), newText: @"public override void M()
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Services\AssetSynchronization\RemoteAssetSynchronizationService.cs (1)
46public ValueTask SynchronizeTextAsync(DocumentId documentId, Checksum baseTextChecksum, IEnumerable<TextChange> textChanges, CancellationToken cancellationToken)
Services\EncapsulateField\RemoteEncapsulateFieldService.cs (2)
41public ValueTask<ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>> EncapsulateFieldsAsync( 60return ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>.Empty;
Microsoft.CodeAnalysis.Remote.Workspaces (1)
IRemoteAssetSynchronizationService.cs (1)
19ValueTask SynchronizeTextAsync(DocumentId documentId, Checksum baseTextChecksum, IEnumerable<TextChange> textChanges, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.UnitTests (15)
Text\SourceTextTests.cs (1)
182var change = new TextChange(span, text.ToString(span));
Text\TextChangeTests.cs (14)
232var changes = new TextChange[] { 248var expected = changes[i]; 249var actual = result[i]; 268private static void AssertChangedTextLinesHelper(string originalText, params TextChange[] changes) 953Assert.Equal("new TextChange(new TextSpan(0, 0), null)", default(TextChange).GetDebuggerDisplay()); 970ArrayBuilder<TextChange> oldChangesBuilder = ArrayBuilder<TextChange>.GetInstance(); 979var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText); 991ArrayBuilder<TextChange> newChangesBuilder = ArrayBuilder<TextChange>.GetInstance(); 999var newChange = new TextChange(new TextSpan(i, length: random.Next(editedLength - i)), newText); 1224var edits1 = new TextChange[] 1235var edits2 = new TextChange[] 1249foreach (var change in changes)
Microsoft.CodeAnalysis.VisualBasic (1)
Syntax\VisualBasicSyntaxTree.vb (1)
532Public Overrides Function GetChanges(oldTree As SyntaxTree) As IList(Of TextChange)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (8)
TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
TriviaDataFactory.ComplexTrivia.vb (1)
98Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
TriviaDataFactory.FormattedComplexTrivia.vb (2)
15Private ReadOnly _textChanges As IList(Of TextChange) 58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
TriviaDataFactory.ModifiedComplexTrivia.vb (1)
90Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
VisualBasicSmartTokenFormatter.vb (1)
34Public Function FormatToken(token As SyntaxToken, cancellationToken As CancellationToken) As IList(Of TextChange) Implements ISmartTokenFormatter.FormatToken
VisualBasicTriviaFormatter.vb (2)
176changes As ArrayBuilder(Of TextChange), 232changes As ArrayBuilder(Of TextChange),
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler.vb (2)
56Protected Overrides Function FormatBasedOnEndToken(document As ParsedDocument, position As Integer, formattingOptions As SyntaxFormattingOptions, cancellationToken As CancellationToken) As IList(Of TextChange) 59Return SpecializedCollections.EmptyList(Of TextChange)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (1)
Formatting\VisualBasicFormatterTestBase.vb (1)
76Private Shared Sub AssertResult(expected As String, buffer As ITextBuffer, changes As IList(Of TextChange))
Microsoft.CodeAnalysis.VisualBasic.Features (4)
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)
73Public Overrides Async Function GetTextChangeAsync(document As Document, selectedItem As CompletionItem, ch As Char?, cancellationToken As CancellationToken) As Task(Of TextChange?)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (12)
Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
98Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
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)
Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
90Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
176changes As ArrayBuilder(Of TextChange), 232changes As ArrayBuilder(Of TextChange),
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
OrganizeImports\VisualBasicOrganizeImportsService.Rewriter.vb (2)
20Public ReadOnly TextChanges As IList(Of TextChange) = New List(Of TextChange)()
VisualBasicSmartTokenFormatter.vb (1)
34Public Function FormatToken(token As SyntaxToken, cancellationToken As CancellationToken) As IList(Of TextChange) Implements ISmartTokenFormatter.FormatToken
Microsoft.CodeAnalysis.Workspaces (133)
AbstractAggregatedFormattingResult.cs (6)
24private readonly CancellableLazy<IList<TextChange>> _lazyTextChanges; 39_lazyTextChanges = new CancellableLazy<IList<TextChange>>(CreateTextChanges); 61public IList<TextChange> GetTextChanges(CancellationToken cancellationToken) 67private IList<TextChange> CreateTextChanges(CancellationToken cancellationToken) 81private IList<TextChange> CreateTextChangesWorker(CancellationToken cancellationToken) 90var result = new List<TextChange>(count);
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))
AbstractTriviaDataFactory.FormattedWhitespace.cs (2)
53public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan) 54=> SpecializedCollections.SingletonEnumerable<TextChange>(new TextChange(textSpan, _newString));
AbstractTriviaDataFactory.Whitespace.cs (1)
90public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
AbstractTriviaFormatter.cs (11)
190protected abstract LineColumnDelta Format(LineColumn lineColumn, SyntaxTrivia trivia, ArrayBuilder<TextChange> changes, CancellationToken cancellationToken); 266public ImmutableArray<TextChange> FormatToTextChanges(CancellationToken cancellationToken) 268using var _ = ArrayBuilder<TextChange>.GetInstance(out var changes); 281return ImmutableArray<TextChange>.Empty; 675private void AddExtraLines(int linesBetweenTokens, ArrayBuilder<TextChange> changes) 703var change = GetWhitespaceTextChange( 713private bool TryGetMatchingChangeIndex(ArrayBuilder<TextChange> changes, out int index) 720var change = changes[i]; 731private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 823private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 826private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes)
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (32)
21private readonly struct IntervalIntrospector : IIntervalIntrospector<TextChange> 23int IIntervalIntrospector<TextChange>.GetStart(TextChange value) => value.Span.Start; 24int IIntervalIntrospector<TextChange>.GetLength(TextChange value) => value.Span.Length; 30private readonly SimpleIntervalTree<TextChange, IntervalIntrospector> _totalChangesIntervalTree = 31SimpleIntervalTree.Create(new IntervalIntrospector(), Array.Empty<TextChange>()); 53foreach (var change in currentChanges) 81SimpleIntervalTree<TextChange, IntervalIntrospector> cumulativeChanges, 82ImmutableArray<TextChange> currentChanges) 84using var overlappingSpans = TemporaryArray<TextChange>.Empty; 85using var intersectingSpans = TemporaryArray<TextChange>.Empty; 94SimpleIntervalTree<TextChange, IntervalIntrospector> cumulativeChanges, 95ImmutableArray<TextChange> currentChanges, 96ref TemporaryArray<TextChange> overlappingSpans, 97ref TemporaryArray<TextChange> intersectingSpans) 99foreach (var change in currentChanges) 124TextChange change, 125in TemporaryArray<TextChange> overlappingSpans, 126in TemporaryArray<TextChange> intersectingSpans) 147private static bool IsPureInsertion(TextChange change) 151TextChange change, 152in TemporaryArray<TextChange> overlappingSpans, 153in TemporaryArray<TextChange> intersectingSpans) 180var otherChange = intersectingSpans[0]; 198TextChange change, 199in TemporaryArray<TextChange> overlappingSpans, 200in TemporaryArray<TextChange> intersectingSpans) 209TextChange change, 210in TemporaryArray<TextChange> overlappingSpans) 229TextChange change, 230in TemporaryArray<TextChange> intersectingSpans)
Formatting\Formatter.cs (9)
269public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 272internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken) 284public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 287internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 299public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 302internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 305private static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 309? SpecializedCollections.EmptyList<TextChange>() 313internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken = default)
Formatting\ISyntaxFormattingService.cs (2)
18ImmutableArray<TextChange> GetFormattingChangesOnTypedCharacter(ParsedDocument document, int caretPosition, IndentationOptions indentationOptions, CancellationToken cancellationToken); 19ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
Formatting\Rules\DefaultFormattingRuleFactoryServiceFactory.cs (2)
32public 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);
FormattingExtensions.cs (2)
255public static TextChange SimpleDiff(this TextChange textChange, string text)
IFormattingResult.cs (1)
17IList<TextChange> GetTextChanges(CancellationToken cancellationToken);
ISmartTokenFormatter.cs (1)
14IList<TextChange> FormatToken(SyntaxToken token, CancellationToken cancellationToken);
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (11)
19public IEnumerable<TextChange> CreateEdits(SourceText originalSourceText, IEnumerable<UnmergedDocumentChanges> unmergedChanges) 21var commentChanges = new List<TextChange>(); 34private static IEnumerable<IEnumerable<TextChange>> PartitionChangesForDocument(IEnumerable<TextChange> changes, SourceText originalSourceText) 36var partitionedChanges = new List<IEnumerable<TextChange>>(); 37var currentPartition = new List<TextChange>(); 42foreach (var change in changes.Skip(1)) 49currentPartition = new List<TextChange>(); 64private List<TextChange> GetCommentChangesForDocument(IEnumerable<IEnumerable<TextChange>> partitionedChanges, string projectName, SourceText oldDocumentText) 66var commentChanges = new List<TextChange>();
LinkedFileDiffMerging\DefaultDocumentTextDifferencingService.cs (2)
25public Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken) 28public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken)
LinkedFileDiffMerging\IMergeConflictHandler.cs (1)
14IEnumerable<TextChange> CreateEdits(SourceText originalSourceText, IEnumerable<UnmergedDocumentChanges> unmergedChanges);
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (17)
109IEnumerable<TextChange> allChanges; 131private static async Task<ImmutableArray<TextChange>> AddDocumentMergeChangesAsync( 134List<TextChange> cumulativeChanges, 140var unmergedDocumentChanges = new List<TextChange>(); 141var successfullyMergedChanges = ArrayBuilder<TextChange>.GetInstance(); 146foreach (var change in textchanges) 159var cumulativeChange = cumulativeChanges[cumulativeChangeIndex]; 223private static IEnumerable<TextChange> MergeChangesWithMergeFailComments( 224IEnumerable<TextChange> mergedChanges, 225IEnumerable<TextChange> commentChanges, 232var combinedChanges = new List<TextChange>(); 238foreach (var mergedChange in mergedChangesList) 289private static IEnumerable<TextChange> NormalizeChanges(IEnumerable<TextChange> changes) 297var normalizedChanges = new List<TextChange>(); 299var currentChange = changes.First(); 300foreach (var nextChange in changes.Skip(1))
LinkedFileDiffMerging\UnmergedDocumentChanges.cs (2)
14public IEnumerable<TextChange> UnmergedChanges { get; } 18public UnmergedDocumentChanges(IEnumerable<TextChange> unmergedChanges, string projectName, DocumentId documentId)
ParsedDocument.cs (4)
62public ParsedDocument WithChange(TextChange change, CancellationToken cancellationToken) 65public ParsedDocument WithChanges(IEnumerable<TextChange> changes, CancellationToken cancellationToken) 71public IEnumerable<TextChange> GetChanges(in ParsedDocument oldDocument) 77return SpecializedCollections.EmptyEnumerable<TextChange>();
Remote\RemoteUtilities.cs (3)
23public static async ValueTask<ImmutableArray<(DocumentId, ImmutableArray<TextChange>)>> GetDocumentTextChangesAsync( 28using var _ = ArrayBuilder<(DocumentId, ImmutableArray<TextChange>)>.GetInstance(out var builder); 50Solution oldSolution, ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> documentTextChanges, CancellationToken cancellationToken)
Rename\IRemoteRenamerService.cs (2)
273public readonly ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> DocumentTextChanges; 289ImmutableArray<(DocumentId, ImmutableArray<TextChange>)> documentTextChanges,
TextChangeRangeExtensions.cs (1)
102public static TextChangeRange ToTextChangeRange(this TextChange textChange)
TriviaData.cs (1)
41public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (5)
21public abstract Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync( 31protected static ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)> MatchMappedSpansToTextChanges( 32ImmutableArray<TextChange> textChanges, 37using var _ = ArrayBuilder<(string, TextChange)>.GetInstance(out var mappedFilePathAndTextChange); 44var newTextChange = new TextChange(mappedSpanResults[i].Span, newText);
Workspace\Host\DocumentService\ISpanMappingService.cs (1)
31Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync(
Workspace\Solution\Document.cs (3)
365public async Task<IEnumerable<TextChange>> GetTextChangesAsync(Document oldDocument, CancellationToken cancellationToken = default) 374return SpecializedCollections.EmptyEnumerable<TextChange>(); 387return SpecializedCollections.EmptyEnumerable<TextChange>();
Workspace\Solution\IDocumentTextDifferencingService.cs (2)
24Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken); 34Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
Formatting\FormattingTestBase.cs (2)
105private static bool TryAdjustSpans(SourceText inputText, IList<TextChange> changes, SourceText outputText, ImmutableArray<TextSpan> inputSpans, out ImmutableArray<TextSpan> outputSpans) 133protected static void AssertResult(string expected, SourceText sourceText, IList<TextChange> result)
TestDocumentServiceProvider.cs (1)
65public Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync(
Microsoft.VisualStudio.LanguageServices (27)
EditorConfigSettings\Common\EditorTextUpdater.cs (1)
28public void UpdateText(IReadOnlyList<TextChange> changes)
ProjectSystem\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)
ProjectSystem\VisualStudioWorkspaceImpl.cs (2)
663async Task<MultiDictionary<string, (TextChange TextChange, ProjectId ProjectId)>> GetMappedTextChanges(SolutionChanges solutionChanges) 665var filePathToMappedTextChanges = new MultiDictionary<string, (TextChange TextChange, ProjectId ProjectId)>();
Venus\ContainedDocument.cs (18)
217public ITextSnapshot ApplyChanges(IEnumerable<TextChange> changes) 236private ITextSnapshot ApplyChanges(SourceText originalText, IEnumerable<TextChange> changes) 264private IEnumerable<TextChange> FilterTextChanges(SourceText originalText, List<TextSpan> editorVisibleSpansInOriginal, IEnumerable<TextChange> changes) 273using var pooledObject = SharedPools.Default<List<TextChange>>().GetPooledObject(); 287var change = changeQueue[changeIndex]; 331private static bool WhitespaceOnEdges(TextSpan visibleTextSpan, TextChange change) 351private IEnumerable<TextChange> GetSubTextChanges(SourceText originalText, TextChange changeInOriginalText, TextSpan visibleSpanInOriginalText) 353using var changes = SharedPools.Default<List<TextChange>>().GetPooledObject(); 368SourceText originalText, TextSpan visibleSpanInOriginalText, string leftText, string rightText, int offsetInOriginalText, List<TextChange> changes) 389if (TryGetSubTextChange(originalText, visibleSpanInOriginalText, rightText, spanInOriginalText, spanInRightText, out var textChange)) 401private IEnumerable<TextChange> GetSubTextChanges( 420if (TryGetSubTextChange(originalText, visibleSpanInOriginalText, rightText, spanInOriginalText, spanInRightText.ToTextSpan(), out var textChange)) 507string rightText, TextSpan spanInOriginalText, TextSpan spanInRightText, out TextChange textChange) 723IEnumerable<TextChange> changes, 733foreach (var change in changes) 821foreach (var change in newChanges)
Venus\ContainedDocument.DocumentServiceProvider.cs (1)
73public override async Task<ImmutableArray<(string mappedFilePath, TextChange mappedTextChange)>> GetMappedTextChangesAsync(
Workspace\VisualStudioFormattingRuleFactoryServiceFactory.cs (2)
96public IEnumerable<TextChange> FilterFormattedChanges(DocumentId documentId, TextSpan span, IList<TextChange> changes)
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
534foreach (var change in changes)
Microsoft.VisualStudio.LanguageServices.UnitTests (3)
Completion\MockCompletionProvider.vb (2)
26Public Overrides Function GetTextChangeAsync(document As Document, selectedItem As CompletionItem, ch As Char?, cancellationToken As CancellationToken) As Task(Of TextChange?) 27Return Task.FromResult(Of TextChange?)(New TextChange(selectedItem.Span, "InsertionText"))
Venus\DocumentService_IntegrationTests.vb (1)
297As Task(Of ImmutableArray(Of (mappedFilePath As String, mappedTextChange As Microsoft.CodeAnalysis.Text.TextChange))) _
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);