1 write to NewText
Microsoft.CodeAnalysis (1)
Text\TextChange.cs (1)
47this.NewText = newText;
100 references to NewText
dotnet-format (3)
Formatters\DocumentFormatter.cs (3)
168var changeMessage = changes.Count > 1 || change.NewText?.Length != formattedText.Length 187var isDelete = string.IsNullOrEmpty(change.NewText); 195var textChange = change.NewText?.Replace(" ", "\\s").Replace("\t", "\\t").Replace("\n", "\\n").Replace("\r", "\\r");
GenerateDocumentationAndConfigFiles (4)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
240var newText = textChange.NewText ?? "";
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
692var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 720if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.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.CodeAnalysis (12)
Text\SourceText.cs (3)
799where !c.Span.IsEmpty || c.NewText?.Length > 0 808var newTextLength = change.NewText?.Length ?? 0; 823var segment = SourceText.From(change.NewText!, this.Encoding, this.ChecksumAlgorithm);
Text\TextChange.cs (8)
55return string.Format("{0}: {{ {1}, \"{2}\" }}", this.GetType().Name, Span, NewText); 67EqualityComparer<string>.Default.Equals(this.NewText, other.NewText); 72return Hash.Combine(this.Span.GetHashCode(), this.NewText?.GetHashCode() ?? 0); 91Debug.Assert(change.NewText is object); 92return new TextChangeRange(change.Span, change.NewText.Length); 102var newTextDisplay = NewText switch 105{ Length: < 10 } => $"\"{NewText}\"",
Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
Microsoft.CodeAnalysis.Analyzers (4)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
240var newText = textChange.NewText ?? "";
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
692var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 720if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
Microsoft.CodeAnalysis.AnalyzerUtilities (4)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
240var newText = textChange.NewText ?? "";
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
692var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 720if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
Microsoft.CodeAnalysis.CodeStyle (14)
src\roslyn\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\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
240var newText = textChange.NewText ?? "";
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
692var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 720if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (2)
89var text = pair.Value.GetTextChanges(GetTextSpan(pair.Key)).Single().NewText ?? ""; 145var text = triviaData.GetTextChanges(GetTextSpan(pair)).Single().NewText ?? "";
Microsoft.CodeAnalysis.CSharp.Features (1)
Copilot\CSharpCopilotProposalAdjusterService.cs (1)
41var lastChangeEndPos = lastTextChange.Span.End + lastTextChange.NewText?.Length ?? 0;
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (2)
89var text = pair.Value.GetTextChanges(GetTextSpan(pair.Key)).Single().NewText ?? ""; 145var text = triviaData.GetTextChanges(GetTextSpan(pair)).Single().NewText ?? "";
Microsoft.CodeAnalysis.Features (22)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (1)
154var delta = textChange.NewText.Length - textChange.Span.Length;
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
114.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);
Copilot\CopilotUtilities.cs (1)
44var newTextLength = change.NewText!.Length;
Copilot\IProposalAdjusterService.cs (2)
193var newText = change.NewText ?? ""; 304var newText = change.NewText ?? "";
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
115properties.Add(new(NewTextKey, textChange.NewText!));
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (1)
102properties.Add(KeyValuePair.Create(NewTextKey, textChange.NewText));
Snippets\RoslynLSPSnippetConverter.cs (2)
35var textChangeText = textChange.NewText; 125var textChangeText = textChange.NewText;
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
204var text = change.TextChange.NewText;
src\roslyn\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.Razor.Compiler (1)
CSharp\TextChangeExtensions.cs (1)
13return new SourceChange(textChange.Span.AsSourceSpan(), textChange.NewText);
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
240var newText = textChange.NewText ?? "";
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
692var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 720if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
Microsoft.CodeAnalysis.Workspaces (19)
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (1)
75var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText!));
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (13)
169if (change.Span != cumulativeChange.Span || change.NewText != cumulativeChange.NewText) 228mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length)); 229currentPositionDelta += commentChangesList[commentChangeIndex].NewText!.Length - commentChangesList[commentChangeIndex].Span.Length; 237currentPositionDelta += mergedChange.NewText!.Length - mergedChange.Span.Length; 245combinedChanges.Add(new TextChange(conflictingCommentInsertionLocation, commentChangesList[commentChangeIndex].NewText!)); 246mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length)); 247currentPositionDelta += commentChangesList[commentChangeIndex].NewText!.Length; 254currentPositionDelta += mergedChange.NewText!.Length - mergedChange.Span.Length; 261mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length)); 263currentPositionDelta += commentChangesList[commentChangeIndex].NewText!.Length - commentChangesList[commentChangeIndex].Span.Length; 283currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
240var newText = textChange.NewText ?? "";
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
692var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 720if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
38var newText = textChanges[i].NewText;
Roslyn.Diagnostics.Analyzers (4)
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
240var newText = textChange.NewText ?? "";
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
692var delta = GetLineColumnDelta(0, changes[index].NewText ?? ""); 720if (change.Span.Contains(insertionPoint) && IsNullOrWhitespace(change.NewText))
Roslyn.Diagnostics.CSharp.Analyzers (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (2)
89var text = pair.Value.GetTextChanges(GetTextSpan(pair.Key)).Single().NewText ?? ""; 145var text = triviaData.GetTextChanges(GetTextSpan(pair)).Single().NewText ?? "";