1 write to NewText
Microsoft.CodeAnalysis (1)
Text\TextChange.cs (1)
46this.NewText = newText;
135 references to NewText
Microsoft.AspNetCore.App.Analyzers (2)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
261properties.Add(NewTextKey, textChange.NewText ?? string.Empty);
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
140properties.Add(NewTextKey, textChange.NewText ?? string.Empty);
Microsoft.AspNetCore.App.Analyzers.Test (14)
RouteEmbeddedLanguage\FrameworkParametersCompletionProviderTests.cs (10)
38Assert.Equal("id", change.TextChange.NewText); 66Assert.Equal("id", change.TextChange.NewText); 94Assert.Equal("id", change.TextChange.NewText); 122Assert.Equal("id", change.TextChange.NewText); 152Assert.Equal("id", change.TextChange.NewText); 180Assert.Equal("id", change.TextChange.NewText); 208Assert.Equal("id", change.TextChange.NewText); 236Assert.Equal("id", change.TextChange.NewText); 264Assert.Equal("ids", change.TextChange.NewText); 998Assert.Equal("id", change.TextChange.NewText);
RouteEmbeddedLanguage\RoutePatternCompletionProviderTests.cs (4)
70Assert.Equal("alpha", change.TextChange.NewText); 123Assert.Equal("alpha", change.TextChange.NewText); 152Assert.Equal("alpha", change.TextChange.NewText); 181Assert.Equal("alpha", change.TextChange.NewText);
Microsoft.CodeAnalysis (12)
Text\SourceText.cs (3)
780where !c.Span.IsEmpty || c.NewText?.Length > 0 789var newTextLength = change.NewText?.Length ?? 0; 804var segment = SourceText.From(change.NewText!, this.Encoding, this.ChecksumAlgorithm);
Text\TextChange.cs (8)
54return string.Format("{0}: {{ {1}, \"{2}\" }}", this.GetType().Name, Span, NewText); 66EqualityComparer<string>.Default.Equals(this.NewText, other.NewText); 71return Hash.Combine(this.Span.GetHashCode(), this.NewText?.GetHashCode() ?? 0); 90Debug.Assert(change.NewText is object); 91return new TextChangeRange(change.Span, change.NewText.Length); 101var newTextDisplay = NewText switch 104{ Length: < 10 } => $"\"{NewText}\"",
Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
Microsoft.CodeAnalysis.CodeStyle (14)
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (10)
62Contract.ThrowIfNull(change.NewText); 64if (change.NewText.Length > 0 && !change.Span.IsEmpty) 69var offset = change.Span.Length - change.NewText.Length; 72if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 81if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), ""); 89Contract.ThrowIfNull(change.NewText); 90if (change.NewText.Length == 0 && change.Span.IsEmpty)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
241var newText = textChange.NewText ?? "";
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
693var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 721if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (2)
90var text = pair.Value.GetTextChanges(GetTextSpan(pair.Key)).Single().NewText ?? ""; 146var text = triviaData.GetTextChanges(GetTextSpan(pair)).Single().NewText ?? "";
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (1)
69edit.Insert(textChange.Span.Start, textChange.NewText);
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
179edit.Replace(change.Span.ToSpan(), change.NewText);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (1)
3454edit.Replace(change.Span.ToSpan(), change.NewText);
Intents\IntentTestsBase.cs (1)
75edit.Replace(change.Span.ToSpan(), change.NewText);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (16)
Syntax\SyntaxDiffingTests.cs (16)
34Assert.Equal("class C { }", changes[0].NewText); 54Assert.Equal("B", changes[0].NewText); 76Assert.Equal("C", changes[0].NewText); 78Assert.Equal("D", changes[1].NewText); 96Assert.Equal("class ", changes[0].NewText); 114Assert.Equal("class A ", changes[0].NewText); 133Assert.Equal("class A { }", changes[0].NewText); 153Assert.Equal("} class A { ", changes[0].NewText); 171Assert.Equal("namespace N { ", changes[0].NewText); 189Assert.Equal("int X; ", changes[0].NewText); 206Assert.Equal("", changes[0].NewText); 223Assert.Equal("", changes[0].NewText); 240Assert.Equal("", changes[0].NewText); 258Assert.Equal("struct", changes[0].NewText); 325Assert.Equal("this.", changes[0].NewText); 387Assert.Equal("o", changes[0].NewText);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (2)
90var text = pair.Value.GetTextChanges(GetTextSpan(pair.Key)).Single().NewText ?? ""; 146var text = triviaData.GetTextChanges(GetTextSpan(pair)).Single().NewText ?? "";
Microsoft.CodeAnalysis.EditorFeatures (8)
AutomaticCompletion\BraceCompletionSessionProvider.BraceCompletionSession.cs (1)
424edit.Replace(change.Span.ToSpan(), change.NewText);
Editor\TextEditApplication.cs (1)
42edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
InlineHints\InlineHintDataTag.cs (1)
48if (this.Hint.ReplacementTextChange?.NewText != other.Hint.ReplacementTextChange?.NewText)
IntelliSense\AsyncCompletion\CommitManager.cs (2)
274edit.Replace(mappedSpan.Span, change.TextChange.NewText); 300view.TryMoveCaretToAndEnsureVisible(new SnapshotPoint(subjectBuffer.CurrentSnapshot, mappedSpan.Start.Position + textChange.NewText?.Length ?? 0));
Interactive\InteractiveWorkspace.cs (1)
52edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Shared\Extensions\ITextBufferExtensions.cs (2)
73edit.Replace(change.Span.ToSpan(), change.NewText); 87edit.Replace(change.Span.ToSpan(), change.NewText);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
Completion\AbstractCompletionProviderTests.cs (1)
755textChange = new TextChange(textChange.Span, textChange.NewText.TrimEnd(commitChar) + commitChar);
Formatting\CoreFormatterTestsBase.cs (1)
168edit.Replace(change.Span.ToSpan(), change.NewText);
Workspaces\EditorTestHostDocument.cs (1)
224edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Extensions.SnapshotSourceText.cs (1)
214edit.Replace(change.Span.ToSpan(), change.NewText);
Microsoft.CodeAnalysis.Features (18)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (1)
154var delta = textChange.NewText.Length - textChange.Span.Length;
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (2)
136.OrderBy(change => change.NewText); 142.Select(changes => new TextSpan(changes.Key.Start, changes.Sum(change => change.NewText!.Length)));
Completion\CommonCompletionProvider.cs (1)
84var insertionText = change.NewText;
Completion\Utilities.cs (1)
39var sumOfDeltas = changes.Sum(c => c.NewText!.Length - c.Span.Length);
Snippets\RoslynLSPSnippetConverter.cs (2)
36var textChangeText = textChange.NewText; 126var textChangeText = textChange.NewText;
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
204var text = change.TextChange.NewText;
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (10)
62Contract.ThrowIfNull(change.NewText); 64if (change.NewText.Length > 0 && !change.Span.IsEmpty) 69var offset = change.Span.Length - change.NewText.Length; 72if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 81if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), ""); 89Contract.ThrowIfNull(change.NewText); 90if (change.NewText.Length == 0 && change.Span.IsEmpty)
Microsoft.CodeAnalysis.LanguageServer.Protocol (10)
Extensions\ProtocolConversions.cs (3)
329Contract.ThrowIfNull(textChange.NewText); 332NewText = textChange.NewText, 425NewText = textChange.NewText ?? string.Empty
Handler\Completion\CompletionResultFactory.cs (4)
517PopulateTextEdit(lspItem, change.Span, change.NewText ?? string.Empty, documentText, itemDefaultsSupported, defaultSpan); 533if (change.NewText == selectedItem.DisplayText) 538NewText = change.NewText!, 677var newText = completionChange.TextChange.NewText;
Handler\InlineCompletions\InlineCompletionsHandler.cs (2)
180var snippetEndPosition = textChange.Span.Start + textChange.NewText!.Length; 230var amountToAdjust = textChangesBefore.Sum(t => t.NewText!.Length - t.Span.Length);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
232var newText = textChange.NewText!.Insert(offsetInTextChange, "$0");
Microsoft.CodeAnalysis.UnitTests (14)
Text\TextChangeTests.cs (14)
251Assert.Equal(expected.NewText, actual.NewText); 664Assert.Equal("Cool ", changes[0].NewText); 720Assert.Equal("ar", changes[0].NewText); 734Assert.Equal(" Bell ", changes[0].NewText); 748Assert.Equal("Cwazy V", changes[0].NewText); 854Assert.Equal("o World", changes[0].NewText); 868Assert.Equal("o", changes[0].NewText); 870Assert.Equal("World", changes[1].NewText); 884Assert.Equal("o", changes[0].NewText); 886Assert.Equal("l", changes[1].NewText); 901Assert.Equal("o World", changes[0].NewText); 919Assert.Equal("o World", changes[0].NewText); 982editedLength = editedLength - newChange.Span.Length + newChange.NewText.Length;
Microsoft.CodeAnalysis.Workspaces (10)
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (1)
80var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText));
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (4)
170if (change.Span != cumulativeChange.Span || change.NewText != cumulativeChange.NewText) 284currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
241var newText = textChange.NewText ?? "";
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
693var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 721if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
39var newText = textChanges[i].NewText;
Microsoft.VisualStudio.LanguageServices (4)
Venus\ContainedDocument.cs (4)
330if (!string.IsNullOrWhiteSpace(change.NewText)) 353var rightText = changeInOriginalText.NewText; 745var newText = change.NewText; 820edit.Replace(change.Span.ToSpan(), change.NewText);
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
514edit.Replace(change.Span.Start, change.Span.Length, change.NewText);