1 write to NewText
Microsoft.CodeAnalysis (1)
Text\TextChange.cs (1)
46this.NewText = newText;
152 references to NewText
Microsoft.CodeAnalysis (12)
InternalUtilities\TextChangeRangeExtensions.cs (1)
104return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
Text\SourceText.cs (3)
670where !c.Span.IsEmpty || c.NewText?.Length > 0 679var newTextLength = change.NewText?.Length ?? 0; 694var 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}\"",
Microsoft.CodeAnalysis.CodeStyle (12)
AbstractTriviaFormatter.cs (2)
693var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 721if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
FormattingAnalyzerHelper.cs (8)
33if (change.NewText.Length > 0 && !change.Span.IsEmpty) 38var offset = change.Span.Length - change.NewText.Length; 41if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 50if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 52change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), ""); 58if (change.NewText.Length == 0 && change.Span.IsEmpty)
FormattingExtensions.cs (1)
258var newText = textChange.NewText ?? "";
TextChangeRangeExtensions.cs (1)
104return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
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 (3)
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (1)
69edit.Insert(textChange.Span.Start, textChange.NewText);
StringCopyPaste\KnownSourcePasteProcessor.cs (1)
182edit.Replace(_selectionSpanBeforePaste.ToSpan(), trivialContentEdit.NewText);
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
191edit.Replace(change.Span.ToSpan(), change.NewText);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (6)
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (4)
337Assert.Equal($"[*.cs]\r\ndotnet_diagnostic.{id}.severity = error", update.NewText); 360Assert.Equal("[*.cs]\r\ncsharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:error", update.NewText); 373Assert.Equal("[*.cs]\r\ncsharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:error", update.NewText); 393Assert.Equal("[*.cs]\r\ncsharp_new_line_before_else = false", update.NewText);
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (1)
3458edit.Replace(change.Span.ToSpan(), change.NewText);
Intents\IntentTestsBase.cs (1)
79edit.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)
TriviaRewriter.cs (2)
90var text = pair.Value.GetTextChanges(GetTextSpan(pair.Key)).Single().NewText ?? ""; 146var text = triviaData.GetTextChanges(GetTextSpan(pair)).Single().NewText ?? "";
Microsoft.CodeAnalysis.EditorFeatures (10)
AutomaticCompletion\BraceCompletionSessionProvider.BraceCompletionSession.cs (1)
426edit.Replace(change.Span.ToSpan(), change.NewText);
InlineHints\InlineHintDataTag.cs (2)
55if (this.Hint.ReplacementTextChange?.NewText != other.Hint.ReplacementTextChange?.NewText)
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (2)
345edit.Replace(change.Span.Start, change.Span.Length, change.NewText); 620buffer.Replace(change.Span.ToSpan(), change.NewText);
IntelliSense\AsyncCompletion\CommitManager.cs (2)
257edit.Replace(mappedSpan.Span, change.TextChange.NewText); 283view.TryMoveCaretToAndEnsureVisible(new SnapshotPoint(subjectBuffer.CurrentSnapshot, mappedSpan.Start.Position + textChange.NewText?.Length ?? 0));
Interactive\InteractiveWorkspace.cs (1)
67edit.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)
605textChange = new TextChange(textChange.Span, textChange.NewText.TrimEnd(commitChar) + commitChar);
Formatting\CoreFormatterTestsBase.cs (1)
169edit.Replace(change.Span.ToSpan(), change.NewText);
Workspaces\TestHostDocument.cs (1)
333edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Extensions.SnapshotSourceText.cs (1)
215edit.Replace(change.Span.ToSpan(), change.NewText);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (1)
764edits.TextChanges.Do(tc => edit.Replace(tc.Span.ToSpan(), tc.NewText));
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
InlineHints\InlineHintsTag.cs (1)
289textChange.NewText);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (4)
SyncNamespaces\SyncNamespacesServiceTests.vb (4)
91Assert.Equal("namespace Test.Namespace.App", textChange.NewText) 202Assert.Equal("namespace Test.Namespace.App", textChange.NewText) 271Assert.Equal("namespace Test.Namespace.App", textChange.NewText) 276Assert.Equal("namespace Test2.Namespace.App", textChange.NewText)
Microsoft.CodeAnalysis.Features (19)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (1)
155var delta = textChange.NewText.Length - textChange.Span.Length;
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (2)
128.OrderBy(change => change.NewText); 134.Select(changes => new TextSpan(changes.Key.Start, changes.Sum(change => change.NewText!.Length)));
Completion\CommonCompletionProvider.cs (1)
84var insertionText = change.NewText;
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (1)
57var snippetText = change.NewText;
Completion\Utilities.cs (1)
39var sumOfDeltas = changes.Sum(c => c.NewText!.Length - c.Span.Length);
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
115properties.Add(NewTextKey, textChange.NewText!);
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (1)
106properties.Add(NewTextKey, textChange.NewText);
FormattingAnalyzerHelper.cs (8)
33if (change.NewText.Length > 0 && !change.Span.IsEmpty) 38var offset = change.Span.Length - change.NewText.Length; 41if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 50if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 52change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), ""); 58if (change.NewText.Length == 0 && change.Span.IsEmpty)
Snippets\RoslynLSPSnippetConverter.cs (2)
38var textChangeText = textChange.NewText; 128var textChangeText = textChange.NewText;
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
210var text = change.TextChange.NewText;
Microsoft.CodeAnalysis.LanguageServer.Protocol (8)
Extensions\ProtocolConversions.cs (3)
212Contract.ThrowIfNull(textChange.NewText); 215NewText = textChange.NewText, 305NewText = textChange.NewText ?? string.Empty
Handler\Completion\CompletionResolveHandler.cs (1)
147var newText = completionChange.TextChange.NewText;
Handler\Completion\ILspCompletionResultCreationService.cs (1)
70var newText = completionChange.TextChange.NewText ?? "";
Handler\InlineCompletions\InlineCompletionsHandler.cs (2)
143var snippetEndPosition = textChange.Span.Start + textChange.NewText!.Length; 193var amountToAdjust = textChangesBefore.Sum(t => t.NewText!.Length - t.Span.Length);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
224var 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.VisualBasic.CodeStyle (2)
TriviaDataFactory.TriviaRewriter.vb (2)
77Dim text = pair.Value.GetTextChanges(GetTextSpan(pair.Key)).Single().NewText 115Dim text = triviaData.GetTextChanges(textSpan).Single().NewText
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (2)
Formatting\Indentation\SmartTokenFormatter_FormatTokenTests.vb (1)
210edit.Replace(change.Span.ToSpan(), change.NewText)
Formatting\VisualBasicFormatterTestBase.vb (1)
79edit.Replace(change.Span.ToSpan(), change.NewText)
Microsoft.CodeAnalysis.VisualBasic.Features (1)
Completion\VisualBasicCompletionService.vb (1)
117Return result.Value.NewText
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (2)
77Dim text = pair.Value.GetTextChanges(GetTextSpan(pair.Key)).Single().NewText 115Dim text = triviaData.GetTextChanges(textSpan).Single().NewText
Microsoft.CodeAnalysis.Workspaces (23)
AbstractTriviaFormatter.cs (2)
693var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 721if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
FormattingExtensions.cs (1)
258var newText = textChange.NewText ?? "";
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (1)
77var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText));
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (17)
169if (change.Span != cumulativeChange.Span || change.NewText != cumulativeChange.NewText) 179if (change.NewText.Contains(cumulativeChange.NewText) || cumulativeChange.NewText.Contains(change.NewText)) 244mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText.Length)); 245currentPositionDelta += (commentChangesList[commentChangeIndex].NewText.Length - commentChangesList[commentChangeIndex].Span.Length); 253currentPositionDelta += (mergedChange.NewText.Length - mergedChange.Span.Length); 261combinedChanges.Add(new TextChange(conflictingCommentInsertionLocation, commentChangesList[commentChangeIndex].NewText)); 262mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText.Length)); 263currentPositionDelta += commentChangesList[commentChangeIndex].NewText.Length; 270currentPositionDelta += (mergedChange.NewText.Length - mergedChange.Span.Length); 277mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText.Length)); 279currentPositionDelta += (commentChangesList[commentChangeIndex].NewText.Length - commentChangesList[commentChangeIndex].Span.Length); 304currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
TextChangeRangeExtensions.cs (1)
104return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
41var newText = textChanges[i].NewText;
Microsoft.VisualStudio.LanguageServices (5)
ProjectSystem\TextEditApplication.cs (1)
42edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Venus\ContainedDocument.cs (4)
333if (!string.IsNullOrWhiteSpace(change.NewText)) 356var rightText = changeInOriginalText.NewText; 748var newText = change.NewText; 823edit.Replace(change.Span.ToSpan(), change.NewText);
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
536edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Microsoft.VisualStudio.LanguageServices.Xaml (2)
Implementation\LanguageServer\Handler\OnAutoInsert\OnAutoInsertHandler.cs (2)
56Contract.ThrowIfNull(result.TextChange.NewText); 57var insertText = result.TextChange.NewText;