1 write to NewLength
Microsoft.CodeAnalysis (1)
Text\TextChangeRange.cs (1)
44this.NewLength = newLength;
78 references to NewLength
Microsoft.CodeAnalysis (35)
Syntax\SyntaxDiffer.cs (10)
109if (change.Range.NewLength > 0) // delete-only ranges cannot be expressed as part of new text 112newSpans.Add(new TextSpan(start, change.Range.NewLength)); 115delta += change.Range.NewLength - change.Range.Span.Length; 581new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + change.Range.Span.Length), last.Range.NewLength + change.Range.NewLength), 604new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + textChangeRange.Span.Length), last.Range.NewLength + textChangeRange.NewLength), 748if (cr.Range.Span.Length > 0 && cr.Range.NewLength > 0) 764range.NewLength - (commonLeadingCount + commonTrailingCount)); 778if (range.Span.Length > 0 || range.NewLength > 0)
Text\ChangedText.cs (1)
38deltaLength += change.NewLength - change.Span.Length;
Text\SourceText.cs (3)
912if (range.NewLength > 0) 914var span = new TextSpan(newPos, range.NewLength); 924newPosDelta += range.NewLength - range.Span.Length;
Text\TextChangeRange.cs (7)
28internal int NewEnd => Span.Start + NewLength; 54other.NewLength == this.NewLength; 71return Hash.Combine(this.NewLength, this.Span.GetHashCode()); 107diff += change.NewLength - change.Span.Length; 134return $"new TextChangeRange(new TextSpan({Span.Start}, {Span.Length}), {NewLength})"; 139return $"TextChangeRange(Span={Span}, NewLength={NewLength})";
Text\TextChangeRangeExtensions.cs (14)
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength; 86currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 97currentNewEnd = newChange.Span.Start + newChange.NewLength; 150if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 234if (newChange.SpanLength <= oldChange.NewLength) 261oldChange = new TextChangeRange(oldChange.Span, oldChange.NewLength - newChange.SpanLength); 308oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 310var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 373oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 430: this(range.Span.Start, range.Span.Length, range.NewLength) 435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
Microsoft.CodeAnalysis.CodeStyle (14)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (14)
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength; 86currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 97currentNewEnd = newChange.Span.Start + newChange.NewLength; 150if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 234if (newChange.SpanLength <= oldChange.NewLength) 261oldChange = new TextChangeRange(oldChange.Span, oldChange.NewLength - newChange.SpanLength); 308oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 310var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 373oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 430: this(range.Span.Start, range.Span.Length, range.NewLength) 435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
Microsoft.CodeAnalysis.CSharp (3)
Parser\Blender.cs (1)
156var finalLength = changeRange.NewLength + (changeRange.Span.Start - start);
Parser\Blender.Reader.cs (1)
134_changeDelta += change.NewLength - change.Span.Length;
Syntax\CSharpSyntaxTree.cs (1)
564if (workingChanges.Count == 1 && workingChanges[0].Span == new TextSpan(0, this.Length) && workingChanges[0].NewLength == newText.Length)
Microsoft.CodeAnalysis.EditorFeatures (2)
Classification\Semantic\AbstractSemanticOrEmbeddedClassificationViewTaggerProvider.cs (1)
174var changedSpan = new TextSpan(collapsedRange.Span.Start, collapsedRange.NewLength);
Classification\Syntactic\SyntacticClassificationTaggerProvider.TagComputer.cs (1)
341? currentSnapshot.GetSpan(changeRange.Value.Span.Start, changeRange.Value.NewLength)
Microsoft.CodeAnalysis.Features (1)
SolutionCrawler\AbstractDocumentDifferenceService.cs (1)
175var lengthDelta = range.NewLength - range.Span.Length;
Microsoft.CodeAnalysis.UnitTests (2)
Text\TextChangeRangeTest.cs (1)
29Assert.Equal(42, range.NewLength);
Text\TextChangeTests.cs (1)
80Assert.Equal(10, changes[0].NewLength);
Microsoft.CodeAnalysis.VisualBasic (5)
Scanner\Blender.vb (4)
222_affectedRange = New TextChangeRange(span, span.Length - _change.Span.Length + _change.NewLength) 230If position >= _change.Span.Start + _change.NewLength Then 231Return position - _change.NewLength + _change.Span.Length 389Dim range = New TextSpan(_affectedRange.Span.Start, _affectedRange.NewLength)
Syntax\VisualBasicSyntaxTree.vb (1)
120If changes.Length = 1 AndAlso changes(0).Span = New TextSpan(0, Me.Length) AndAlso changes(0).NewLength = newText.Length Then
Microsoft.CodeAnalysis.Workspaces (16)
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (14)
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength; 86currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 97currentNewEnd = newChange.Span.Start + newChange.NewLength; 150if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 234if (newChange.SpanLength <= oldChange.NewLength) 261oldChange = new TextChangeRange(oldChange.Span, oldChange.NewLength - newChange.SpanLength); 308oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 310var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 373oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 430: this(range.Span.Start, range.Span.Length, range.NewLength) 435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
Workspace\Solution\DocumentState.cs (2)
279if (change.NewLength == newText.Length) 285if (change.Span.Length < MaxTextChangeRangeLength && change.NewLength < MaxTextChangeRangeLength)