504 references to TextChange
IdeCoreBenchmarks (5)
IncrementalSourceGeneratorBenchmarks.cs (1)
167var changedText = sourceText.WithChanges(new TextChange(sourceText.Lines[0].Span, $"// added text{i}"));
SyntacticChangeRangeBenchmark.cs (4)
54var newText = _text.WithChanges(new TextChange(new TextSpan(_index + 8, 1), "m")); 63var newText = _text.WithChanges(new TextChange(new TextSpan(_index, 0), "var v = x ")); 72var newText = _text.WithChanges(new TextChange(new TextSpan(0, addedText.Length), addedText)); 81var newText = _text.WithChanges(new TextChange(new TextSpan(_text.Length - addedText.Length, addedText.Length), addedText));
Microsoft.AspNetCore.App.Analyzers (4)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (2)
88new TextChange(new TextSpan(int.Parse(startString, CultureInfo.InvariantCulture), int.Parse(lengthString, CultureInfo.InvariantCulture)), newText), 529new TextChange(replacementSpan, insertionText),
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (2)
82new TextChange(new TextSpan(int.Parse(startString, CultureInfo.InvariantCulture), int.Parse(lengthString, CultureInfo.InvariantCulture)), newText), 381new TextChange(replacementSpan, escapedInsertionText),
Microsoft.CodeAnalysis (4)
Syntax\SyntaxDiffer.cs (2)
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)
861return this.WithChanges(new TextChange(span, newText)); 922textChanges.Add(new TextChange(range.Span, newt));
Microsoft.CodeAnalysis.CodeStyle (6)
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
74change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Microsoft.CodeAnalysis.CodeStyle.Fixes (8)
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (8)
333edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 337edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 346edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 350edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 359edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 365edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 371edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 376edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
268changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 378changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
174return new TextChange( 235return new TextChange(new TextSpan(textLine.Start, 0), newText: indentation);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
93edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
95edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 96edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.EditorFeatures (9)
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
261var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (3)
126return new TextChange(new TextSpan(position + 1, 0), "\"\"\""); 183return new TextChange(new TextSpan(position + 1, 0), "\""); 240return new TextChange(new TextSpan(token.GetRequiredParent().Span.End, 0), "\"");
StringCopyPaste\KnownSourcePasteProcessor.cs (5)
189edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 193edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 218edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 238edits.Add(new TextChange(new TextSpan(interpolation.OpenBraceToken.Span.End, 0), new string('{', dollarSignsToAdd))); 239edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd)));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
StringIndentation\StringIndentationTests.cs (1)
57changes.Add(new TextChange(new TextSpan(lineStart + offset - 1, 1), "|"));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenTupleTest.cs (1)
22617var newText = text.WithChanges(new TextChange(new TextSpan(pos, 0), " ")); // add space before closing-paren
Microsoft.CodeAnalysis.CSharp.Features (27)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
129newLineEdit = new TextChange(new TextSpan(annotatedNewline.SpanStart, 0), annotatedNewline.ToString());
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (4)
259return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - SpaceEqualsString.Length)); 266return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - EqualsString.Length)); 273return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - ColonString.Length)); 277return new TextChange(selectedItem.Span, displayText);
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
382return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
200new TextChange(TextSpan.FromBounds(replacementStart, tokenOnLeft.Span.End), text),
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (4)
95builder.Add(new TextChange(new TextSpan(expression.SpanStart, 0), castText)); 107builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), ")")); 112builder.Add(new TextChange(new TextSpan(questionToken.Value.SpanStart, 0), ")")); 114builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), ""));
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (1)
88return new TextChange(selectedItem.Span, insertionText);
Completion\CompletionProviders\TupleNameCompletionProvider.cs (1)
118return Task.FromResult<TextChange?>(new TextChange(
InlineHints\CSharpInlineTypeHintsService.cs (4)
81? new TypeHint(parameter.Type, span, textChange: new TextChange(span, GetTypeDisplayString(parameter.Type) + " "), trailingSpace: true) 95return new(type, span, new TextChange(span, " " + GetTypeDisplayString(type)), leadingSpace: true); 108return new(type, span, new TextChange(span, GetTypeDisplayString(type)), leadingSpace: true); 131return new TypeHint(type, span, new TextChange(displayAllSpan.Span, GetTypeDisplayString(type)), trailingSpace: trailingSpace);
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
79return new TextChange(TextSpan.FromBounds(targetPosition, targetPosition), SyntaxFacts.GetText(SyntaxKind.PublicKeyword) + " ");
Snippets\CSharpConstructorSnippetProvider.cs (1)
75return new TextChange(TextSpan.FromBounds(position, position), constructorDeclaration.NormalizeWhitespace().ToFullString());
Snippets\CSharpElseSnippetProvider.cs (1)
60return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), elseClause.ToFullString()));
Snippets\CSharpSnippetFunctionService.cs (1)
55var textChange = new TextChange(caseGenerationLocation, str);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
174return new TextChange( 235return new TextChange(new TextSpan(textLine.Start, 0), newText: indentation);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
93edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
95edits.Add(new TextChange(TextSpan.FromBounds(start, end), "")); 96edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\BindingAwaitTests.cs (1)
29TextChange change = new TextChange(span, "/*comment*/");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Symbols\Metadata\MetadataTypeTests.cs (2)
365var change = new TextChange(span, text1); 380change = new TextChange(span, text2);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (50)
IncrementalParsing\IncrementalParsingTests.cs (48)
496var change = new TextChange(span, "."); 528var change = new TextChange(span, " "); 574text = text.WithChanges(new TextChange(prefixSpan, ""), new TextChange(suffixSpan, "")); 626var withOpenBraceDeletedText = initialText.WithChanges(new TextChange(openBraceLine.SpanIncludingLineBreak, "")); 837var withCloseBraceDeletedText = withOpenBraceDeletedText.WithChanges(new TextChange(closeBraceLine.SpanIncludingLineBreak, "")); 1395var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 1409var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 3178new TextChange(new TextSpan(str.IndexOf(" abc", StringComparison.Ordinal), 0), "//"), 3179new TextChange(new TextSpan(str.IndexOf(" 123", StringComparison.Ordinal), 0), "//"), 3180new TextChange(new TextSpan(str.IndexOf(" def", StringComparison.Ordinal), 0), "//")); 3200var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), "{")); 3216var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"System.Console.WriteLine(false) 3275var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"if (false) 3331var change = new TextChange(span, text1); 3345change = new TextChange(span, text2); 3414var change = new TextChange(span, "// "); 3451var change = new TextChange(span, "// "); 3530var change = new TextChange(new TextSpan(0, 0), items[1]); // Prepend 3629var change = new TextChange(span, "p"); 3650var change = new TextChange(span, ""); 3671var change = new TextChange(span, "["); 3692var change = new TextChange(span, "[Obsolete]"); 3713var change = new TextChange(span, "public"); 3735var change = new TextChange(span, "c"); 3759var change = new TextChange(span, "1, Attr2"); 3783var change = new TextChange(span, ", Attr2"); 3807var change = new TextChange(span, " [Attr2]"); 3831var change = new TextChange(span, "Arg"); 3855var change = new TextChange(span, "2"); 3881var change = new TextChange(span, "1, Attr2"); 3906var change = new TextChange(span, "[Attr]"); 3932var change = new TextChange(span, " [Attr2]"); 3958var change = new TextChange(span, ""); 3976var change = new TextChange(span, ".z"); 3994var change = new TextChange(span, " if (c) { }"); 4012var change = new TextChange(span, " else (c) { }"); 4026var change = new TextChange(span, ""); 4040var change = new TextChange(span, "{ "); 4055var change = new TextChange(span, ""); 4092var change = new TextChange(span, "["); 4118new TextChange(new TextSpan(position1, 0), "n"), 4119new TextChange(new TextSpan(position2, 0), "n"), 4120new TextChange(new TextSpan(position3, 0), "n")); 4158new TextChange(new TextSpan(locationOfChange, 0), "/*"), 4159new TextChange(new TextSpan(locationOfChange + widthOfChange, 0), "*/") 4168var newText = oldText.WithChanges(new TextChange(new TextSpan(locationOfChange, widthOfChange), "")); 4194var newText = oldText.WithChanges(new TextChange(new TextSpan(oldText.Length, 0), newChar.ToString()));
Syntax\SyntaxNodeTests.cs (2)
910var tree2 = tree1.WithChangedText(tree1.GetText().WithChanges(new TextChange(default, " "))); 921var 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)
OrganizeImports\CSharpOrganizeImportsService.Rewriter.cs (1)
73this.TextChanges.Add(new TextChange(GetTextSpan(list), GetNewText(organizedList)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (2)
268changes.Add(new TextChange(trivia.FullSpan, newComment.ToFullString())); 378changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
Microsoft.CodeAnalysis.EditorFeatures (11)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (1)
207var insertChange = new TextChange(new TextSpan(insertPosition, 0), endingString);
CommentSelection\AbstractCommentSelectionBase.cs (2)
80=> textChanges.Add(new TextChange(new TextSpan(position, 0), text)); 83=> textChanges.Add(new TextChange(span, string.Empty));
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (1)
100var textChange = new TextChange(span, newLine);
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (1)
58var textChange = new TextChange(span, newText);
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (4)
185textChange = new TextChange(curLine.Span, $"{untrimmedKey}= {optionValue}{comment}"); 306return (editorConfigText.WithChanges(new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry)), lastValidHeaderSpanEnd, lastValidSpecificHeaderSpanEnd); 315return (editorConfigText.WithChanges(new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry)), lastValidHeaderSpanEnd, lastValidSpecificHeaderSpanEnd); 349var result = editorConfigText.WithChanges(new TextChange(new TextSpan(editorConfigText.Length, 0), prefix + newEntry));
IntelliSense\AsyncCompletion\CompletionSource.cs (1)
195buffer.ApplyChange(new TextChange(TextSpan.FromBounds(caretPoint - 2, caretPoint), string.Empty));
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
187var textChange = new TextChange(new TextSpan(_snapshotSpan.Start, _snapshotSpan.Length), _stateMachine.TrackingSession.OriginalName);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Completion\AbstractCompletionProviderTests.cs (2)
761textChange = new TextChange(textChange.Span, textChange.NewText.TrimEnd(commitChar) + commitChar); 769var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString());
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (85)
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (81)
87CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, supportBlockComments: true); 103new TextChange(new TextSpan(8, 0), "/*"), 104new TextChange(new TextSpan(14, 0), "*/"), 117new TextChange(new TextSpan(0, 0), "//"), 118new TextChange(new TextSpan(16, 0), "//"), 127CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, supportBlockComments: false); 145new TextChange(new TextSpan(20, 0), "//"), 146new TextChange(new TextSpan(34, 0), "//"), 147new TextChange(new TextSpan(41, 0), "//"), 171new TextChange(new TextSpan(0, 0), "//"), 172new TextChange(new TextSpan(9, 0), "//"), 173new TextChange(new TextSpan(12, 0), "//"), 174new TextChange(new TextSpan(30, 0), "//"), 185new TextChange(new TextSpan(0, 0), "//"), 186new TextChange(new TextSpan(11, 0), "//"), 187new TextChange(new TextSpan(16, 0), "//"), 188new TextChange(new TextSpan(36, 0), "//"), 211new TextChange(new TextSpan(20, 0), "//"), 212new TextChange(new TextSpan(34, 0), "//"), 213new TextChange(new TextSpan(41, 0), "//"), 232new TextChange(new TextSpan(20, 0), "//"), 233new TextChange(new TextSpan(34, 0), "//"), 234new TextChange(new TextSpan(41, 0), "//"), 254new TextChange(new TextSpan(20, 0), "//"), 255new TextChange(new TextSpan(34, 0), "//"), 256new TextChange(new TextSpan(41, 0), "//"), 277new TextChange(new TextSpan(20, 0), "/*"), 278new TextChange(new TextSpan(21, 0), "*/"), 279new TextChange(new TextSpan(34, 0), "//"), 280new TextChange(new TextSpan(41, 0), "/*"), 281new TextChange(new TextSpan(42, 0), "*/"), 282new TextChange(new TextSpan(52, 0), "//"), 302new TextChange(new TextSpan(20, 0), "//"), 303new TextChange(new TextSpan(34, 0), "//"), 304new TextChange(new TextSpan(41, 0), "//"), 313UncommentSelection(code, new[] { new TextChange(new TextSpan(0, 2), string.Empty) }, Span.FromBounds(0, 6), supportBlockComments: true); 322new TextChange(new TextSpan(7, 2), string.Empty), 323new TextChange(new TextSpan(30, 2), string.Empty), 335new TextChange(new TextSpan(11, 2), string.Empty), 336new TextChange(new TextSpan(34, 2), string.Empty), 359new TextChange(new TextSpan(18, 2), string.Empty), 360new TextChange(new TextSpan(34, 2), string.Empty), 361new TextChange(new TextSpan(47, 2), string.Empty), 362new TextChange(new TextSpan(68, 2), string.Empty), 363new TextChange(new TextSpan(119, 2), string.Empty), 364new TextChange(new TextSpan(128, 2), string.Empty), 385new TextChange(new TextSpan(20, 2), string.Empty), 386new TextChange(new TextSpan(23, 2), string.Empty), 387new TextChange(new TextSpan(38, 2), string.Empty), 388new TextChange(new TextSpan(49, 2), string.Empty), 389new TextChange(new TextSpan(52, 2), string.Empty), 390new TextChange(new TextSpan(64, 2), string.Empty), 411new TextChange(new TextSpan(2, 2), string.Empty), 412new TextChange(new TextSpan(19, 2), string.Empty), 413new TextChange(new TextSpan(26, 2), string.Empty), 423CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, new[] { new Span(0, 15) }, supportBlockComments: true); 433new TextChange(new TextSpan(6, 2), string.Empty), 434new TextChange(new TextSpan(16, 2), string.Empty) 447new TextChange(new TextSpan(19, 2), string.Empty), 448new TextChange(new TextSpan(29, 2), string.Empty) 461new TextChange(new TextSpan(0, 2), string.Empty), 462new TextChange(new TextSpan(15, 2), string.Empty) 475new TextChange(new TextSpan(0, 2), string.Empty), 476new TextChange(new TextSpan(15, 2), string.Empty) 513new TextChange(new TextSpan(18, 2), string.Empty), 514new TextChange(new TextSpan(112, 2), string.Empty), 544new TextChange(new TextSpan(20, 2), string.Empty), 545new TextChange(new TextSpan(114, 2), string.Empty), 573new TextChange(new TextSpan(18, 2), string.Empty), 574new TextChange(new TextSpan(112, 2), string.Empty), 602new TextChange(new TextSpan(18, 2), string.Empty), 603new TextChange(new TextSpan(112, 2), string.Empty), 631new TextChange(new TextSpan(55, 2), string.Empty), 659new TextChange(new TextSpan(55, 2), string.Empty), 687new TextChange(new TextSpan(18, 2), string.Empty), 688new TextChange(new TextSpan(28, 2), string.Empty), 689new TextChange(new TextSpan(44, 2), string.Empty), 690new TextChange(new TextSpan(53, 2), string.Empty), 691new TextChange(new TextSpan(78, 2), string.Empty), 692new TextChange(new TextSpan(109, 2), string.Empty), 693new TextChange(new TextSpan(118, 2), string.Empty),
Completion\CompletionServiceTests.cs (1)
126return Task.FromResult(CompletionChange.Create(new TextChange(item.Span, nameof(DebugAssertTestCompletionProvider))));
Snippets\RoslynLSPSnippetConvertTests.cs (3)
404[], new TextChange(new TextSpan(8, 0), "quux"), triggerLocation: 12, CancellationToken.None).Result; 415[], new TextChange(new TextSpan(4, 4), "bar quux"), triggerLocation: 12, CancellationToken.None).Result; 492var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length));
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
IntelliSense\CSharpCompletionCommandHandlerTests.vb (2)
8238New TextChange(New TextSpan(0, _caretPosition), newText)) 8280Return Task.FromResult(CompletionChange.Create(New TextChange(item.Span, commitText)))
Microsoft.CodeAnalysis.Features (46)
BraceCompletion\AbstractBraceCompletionService.cs (1)
61var braceTextEdit = new TextChange(TextSpan.FromBounds(closingPoint, closingPoint), ClosingBrace.ToString());
CodeFixes\Configuration\ConfigurationUpdater.cs (5)
500textChange = new TextChange(curLine.Span, $"{untrimmedKey}={newOptionValue}{newSeverityValue}{commentValue}"); 556textChange = new TextChange(curLine.Span, $"{untrimmedKey}={newSeverityValue}{commentValue}"); 720var textChange = new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry); 730var textChange = new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry); 768var textChange = new TextChange(new TextSpan(result.Length, 0), prefix + newEntry);
Completion\CommonCompletionProvider.cs (2)
83new TextChange(item.Span, item.DisplayText); 113?? new TextChange(item.Span, item.DisplayText);
Completion\CompletionProvider.cs (1)
79=> Task.FromResult(CompletionChange.Create(new TextChange(item.Span, item.DisplayText)));
Completion\CompletionService.cs (2)
259return CompletionChange.Create(new TextChange(new TextSpan(), "")); 267return CompletionChange.Create(new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
305new TextChange(replacementSpan, replacementText),
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
280var textChange = new TextChange(item.Span, assemblyName);
Completion\Providers\AbstractKeywordCompletionProvider.cs (1)
74=> Task.FromResult((TextChange?)new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
250var textChange = new TextChange(text.Lines[lineNumber].SpanIncludingLineBreak, string.Empty);
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (1)
116return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
469=> Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, GetInsertionText(selectedItem, ch)));
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (2)
135return CompletionChange.Create(new TextChange(completionItem.Span, completionText)); 160builder.Add(new TextChange(completionItem.Span, insertText));
Completion\Utilities.cs (2)
22return new TextChange(new TextSpan(0, 0), ""); 42return new TextChange(totalOldSpan, newText.ToString(totalNewSpan));
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
227new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText)));
EmbeddedLanguages\DateAndTime\EmbeddedCompletionContext.cs (1)
145new TextChange(_replacementSpan, displayText)),
EmbeddedLanguages\RegularExpressions\LanguageServices\EmbeddedCompletionContext.cs (1)
64new TextChange(replacementSpan, escapedInsertionText),
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (2)
288new TextChange(new TextSpan(context.Position, 0), name), newPosition: null))); 456new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText),
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
113replacementTextChange = new TextChange(textSpan, inlineHintText);
Snippets\SnippetFunctionService.cs (1)
43var textChange = new TextChange(fieldSpan, fullyQualifiedTypeName);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
55var change = new TextChange(TextSpan.FromBounds(position, position), resultingNode.ToFullString());
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (1)
71return new TextChange(TextSpan.FromBounds(inlineExpressionInfo?.Node.SpanStart ?? position, position), statement.ToFullString());
Snippets\SnippetProviders\AbstractLockSnippetProvider.cs (1)
19return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), statement.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractMainMethodSnippetProvider.cs (1)
36return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), method.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractPropertySnippetProvider.cs (1)
24return new TextChange(TextSpan.FromBounds(position, position), propertyDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (1)
25var mainChange = new TextChange(TextSpan.FromBounds(position, position), typeDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractUsingSnippetProvider.cs (1)
24return new TextChange(TextSpan.FromBounds(position, position), statement.NormalizeWhitespace().ToFullString());
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
74change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (8)
333edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 337edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 346edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 350edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 359edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 365edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 371edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 376edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
Wrapping\AbstractCodeActionComputer.cs (1)
90new TextChange(TextSpan.FromBounds(nodeOrToken.Span.End, OriginalSourceText.Length), newLine));
Microsoft.CodeAnalysis.LanguageServer.Protocol (6)
Extensions\ProtocolConversions.cs (2)
338=> new TextChange(RangeToTextSpan(edit.Range, oldText), edit.NewText); 341=> new TextChange(RangeToTextSpan(changeEvent.Range, text), changeEvent.Text);
Handler\Completion\CompletionResultFactory.cs (1)
561return CompletionChange.Create(new TextChange(completionItem.Span, completionItem.DisplayText));
Handler\InlineCompletions\InlineCompletionsHandler.cs (3)
186var textChange = new TextChange(snippetShortcut, snippetFullText); 226lspTextChanges.Add(new TextChange(caretInSnippetContext, "$0")); 261originalSourceText.WithChanges(new TextChange(snippetSpan, parsedSnippet.DefaultText)));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (5)
Completion\CompletionResolveTests.cs (1)
503var textChange = new TextChange(span: new TextSpan(start: 77, length: 9), newText: @"public override void M()
Diagnostics\PullDiagnosticTests.cs (4)
1639var newCsProj2Document = csproj2Document.WithText(csproj2DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj2DocumentText), "B"))); 1727var newCsProj3Document = csproj3Document.WithText(csproj3DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj3DocumentText), "C"))); 1797var newCsProj2Document = csproj2Document.WithText(csproj2DocumentText.WithChanges(new TextChange(ProtocolConversions.RangeToTextSpan(caretLocation, csproj2DocumentText), "B"))); 2228text = text.WithChanges(new TextChange(new TextSpan(position.Value, 0), textToInsert));
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (1)
NullableEnablePublicApiFix.cs (1)
67SourceText newSourceText = sourceText.WithChanges(new TextChange(new TextSpan(0, 0), extraLine));
Microsoft.CodeAnalysis.UnitTests (156)
Text\SourceTextTests.cs (1)
192var 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)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
49Return SpecializedCollections.SingletonEnumerable(New TextChange(textSpan, Me._newString))
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (2)
186changes.Add(New TextChange(trivia.FullSpan, lineContinuation.ToFullString())) 257changes.Add(New TextChange(trivia.FullSpan, docComment.ToFullString()))
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (2)
EndConstructGeneration\SpitLinesResult.vb (1)
52subjectBuffer.ApplyChange(New TextChange(New TextSpan(caretPosition, 0), joinedLines))
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
341subjectBuffer.ApplyChange(New TextChange(New TextSpan(insertPosition, 0), endText))
Microsoft.CodeAnalysis.VisualBasic.Features (6)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (1)
252Dim updatedText = text.WithChanges(New TextChange(TextSpan.FromBounds(insertionPoint, insertionPoint), stringToAppend))
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.MoveToLineCodeAction.vb (1)
38Dim textWithoutLine = text.WithChanges(New TextChange(textLineToMove.SpanIncludingLineBreak, ""))
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (3)
235change = New TextChange(symbolItem.Span, insertionText.Substring(0, insertionText.Length - s_colonEquals.Length)) 237change = New TextChange(selectedItem.Span, insertionText.Substring(0, insertionText.Length - (s_colonEquals.Length - 1))) 239change = New TextChange(symbolItem.Span, insertionText)
Completion\CompletionProviders\PartialTypeCompletionProvider.vb (1)
77Return New TextChange(selectedItem.Span, insertionText)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (14)
IncrementalParser\IncrementalParser.vb (14)
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, "") 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 (8)
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (2)
75var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText!)); 84commentChanges.Add(new TextChange(TextSpan.FromBounds(startLineStartPosition, startLineStartPosition), warningText));
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (1)
282currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
52=> [new TextChange(textSpan, _newString)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
264return new TextChange(span, newText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
823=> new(span, GetWhitespaceString(lineColumn, delta)); 828changes.Add(new TextChange(span, newText));
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
41var newTextChange = new TextChange(mappedSpanResults[i].Span, newText);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
GenerateFileForEachAdditionalFileWithContentsCommented.cs (1)
32var changes = sourceText.Lines.SelectAsArray(l => new TextChange(new TextSpan(l.Start, length: 0), "// "));
Microsoft.CodeAnalysis.Workspaces.UnitTests (7)
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
565var newText = existingText.WithChanges(new TextChange(new TextSpan(existingText.Length, length: 0), " With Change"));
SymbolKeyTests.cs (3)
874var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 921var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 1419var newTree = syntaxTree.WithChangedText(text.WithChanges(new TextChange(new TextSpan(0, text.Length), text.ToString().Replace(" ", " "))));
SyntaxPathTests.cs (3)
95var newText = text.WithChanges(new TextChange(new TextSpan(0, 0), "class C {}")); 109var newText = text.WithChanges(new TextChange(new TextSpan(0, text.Length), "")); 430var newFullText = oldFullText.WithChanges(new TextChange(new TextSpan(offset, length), newText));
Microsoft.VisualStudio.LanguageServices (4)
Venus\ContainedDocument.cs (4)
522textChange = new TextChange(spanInOriginalText, snippetInRightText); 547textChange = new TextChange( 568textChange = new TextChange( 585textChange = new TextChange(
Microsoft.VisualStudio.LanguageServices.UnitTests (3)
Completion\MockCompletionProvider.vb (1)
27Return Task.FromResult(Of TextChange?)(New TextChange(selectedItem.Span, "InsertionText"))
Preview\PreviewChangesTests.vb (2)
276Dim textChange1 = New TextChange(New TextSpan(19, 1), "N") 279Dim textChange2 = New TextChange(New TextSpan(47, 1), "Y")
Roslyn.VisualStudio.Next.UnitTests (2)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
51var newText = oldText.WithChanges([new TextChange(new TextSpan(0, 1), "abc")]);
Services\ServiceHubServicesTests.cs (1)
102var newText = oldText.WithChanges(new TextChange(TextSpan.FromBounds(0, 0), "/* test */"));