src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (19)
38var currentStart = accumulatedTextChangeSoFar.Value.Span.Start;
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength;
69if (newChange.Span.Start < currentStart)
71currentStart = newChange.Span.Start;
97currentNewEnd = newChange.Span.Start + newChange.NewLength;
162else if (newChange.SpanEnd <= oldChange.Span.Start + oldDelta)
180else if (newChange.SpanStart < oldChange.Span.Start + oldDelta)
199var newChangeLeadingDeletion = oldChange.Span.Start + oldDelta - newChange.SpanStart;
201newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newChange.SpanLength - newChangeLeadingDeletion, newChange.NewLength);
204else if (newChange.SpanStart > oldChange.Span.Start + oldDelta)
222var oldChangeLeadingInsertion = newChange.SpanStart - (oldChange.Span.Start + oldDelta);
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion));
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
311newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newDeletion, newChange.NewLength);
388if (last.Span.End == change.Span.Start)
391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
394else if (last.Span.End > change.Span.Start)
430: this(range.Span.Start, range.Span.Length, range.NewLength)
435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (12)
161if (operationSpan.Start < baseSpan.Start ||
207var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start;
226var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0);
412var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length);
449var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0);
471var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0);
475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
542var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length);
600var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
629var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
651=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (19)
38var currentStart = accumulatedTextChangeSoFar.Value.Span.Start;
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength;
69if (newChange.Span.Start < currentStart)
71currentStart = newChange.Span.Start;
97currentNewEnd = newChange.Span.Start + newChange.NewLength;
162else if (newChange.SpanEnd <= oldChange.Span.Start + oldDelta)
180else if (newChange.SpanStart < oldChange.Span.Start + oldDelta)
199var newChangeLeadingDeletion = oldChange.Span.Start + oldDelta - newChange.SpanStart;
201newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newChange.SpanLength - newChangeLeadingDeletion, newChange.NewLength);
204else if (newChange.SpanStart > oldChange.Span.Start + oldDelta)
222var oldChangeLeadingInsertion = newChange.SpanStart - (oldChange.Span.Start + oldDelta);
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion));
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
311newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newDeletion, newChange.NewLength);
388if (last.Span.End == change.Span.Start)
391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
394else if (last.Span.End > change.Span.Start)
430: this(range.Span.Start, range.Span.Length, range.NewLength)
435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (12)
161if (operationSpan.Start < baseSpan.Start ||
207var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start;
226var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0);
412var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length);
449var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0);
471var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0);
475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
542var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length);
600var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
629var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
651=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (19)
38var currentStart = accumulatedTextChangeSoFar.Value.Span.Start;
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength;
69if (newChange.Span.Start < currentStart)
71currentStart = newChange.Span.Start;
97currentNewEnd = newChange.Span.Start + newChange.NewLength;
162else if (newChange.SpanEnd <= oldChange.Span.Start + oldDelta)
180else if (newChange.SpanStart < oldChange.Span.Start + oldDelta)
199var newChangeLeadingDeletion = oldChange.Span.Start + oldDelta - newChange.SpanStart;
201newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newChange.SpanLength - newChangeLeadingDeletion, newChange.NewLength);
204else if (newChange.SpanStart > oldChange.Span.Start + oldDelta)
222var oldChangeLeadingInsertion = newChange.SpanStart - (oldChange.Span.Start + oldDelta);
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion));
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
311newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newDeletion, newChange.NewLength);
388if (last.Span.End == change.Span.Start)
391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
394else if (last.Span.End > change.Span.Start)
430: this(range.Span.Start, range.Span.Length, range.NewLength)
435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (12)
161if (operationSpan.Start < baseSpan.Start ||
207var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start;
226var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0);
412var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length);
449var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0);
471var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0);
475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
542var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length);
600var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
629var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
651=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (19)
38var currentStart = accumulatedTextChangeSoFar.Value.Span.Start;
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength;
69if (newChange.Span.Start < currentStart)
71currentStart = newChange.Span.Start;
97currentNewEnd = newChange.Span.Start + newChange.NewLength;
162else if (newChange.SpanEnd <= oldChange.Span.Start + oldDelta)
180else if (newChange.SpanStart < oldChange.Span.Start + oldDelta)
199var newChangeLeadingDeletion = oldChange.Span.Start + oldDelta - newChange.SpanStart;
201newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newChange.SpanLength - newChangeLeadingDeletion, newChange.NewLength);
204else if (newChange.SpanStart > oldChange.Span.Start + oldDelta)
222var oldChangeLeadingInsertion = newChange.SpanStart - (oldChange.Span.Start + oldDelta);
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion));
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
311newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newDeletion, newChange.NewLength);
388if (last.Span.End == change.Span.Start)
391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
394else if (last.Span.End > change.Span.Start)
430: this(range.Span.Start, range.Span.Length, range.NewLength)
435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (12)
161if (operationSpan.Start < baseSpan.Start ||
207var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start;
226var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0);
412var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length);
449var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0);
471var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0);
475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
542var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length);
600var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
629var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
651=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (5)
403return Cast<TDeclarationNode>(AppendTriviaAtPosition(newMember, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
411return Cast<TDeclarationNode>(AppendTriviaAtPosition(newAccessor, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
419return Cast<TDeclarationNode>(AppendTriviaAtPosition(newCompilationUnit, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
427return Cast<TDeclarationNode>(AppendTriviaAtPosition(newParameter, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
434return Cast<TDeclarationNode>(AppendTriviaAtPosition(newTypeParameter, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
Rename\CSharpRenameRewriterLanguageService.cs (6)
109newSpan = new TextSpan(oldSpan.Start, newSpan.Length);
314_renameSpansTracker.AddComplexifiedSpan(_documentId, oldSpan, new TextSpan(oldSpan.Start, newSpan.Length), _modifiedSubSpans);
346var symbols = RenameUtilities.GetSymbolsTouchingPosition(token.Span.Start, _semanticModel, _solution.Services, _cancellationToken);
866var token = await tree.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false);
894var token = await location.SourceTree!.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false);
971implicitReferenceLocation.Location.SourceSpan.Start, cancellationToken, findInsideTrivia: false).ConfigureAwait(false);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (5)
403return Cast<TDeclarationNode>(AppendTriviaAtPosition(newMember, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
411return Cast<TDeclarationNode>(AppendTriviaAtPosition(newAccessor, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
419return Cast<TDeclarationNode>(AppendTriviaAtPosition(newCompilationUnit, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
427return Cast<TDeclarationNode>(AppendTriviaAtPosition(newParameter, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
434return Cast<TDeclarationNode>(AppendTriviaAtPosition(newTypeParameter, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
Copilot\IProposalAdjusterService.cs (21)
203span.Start > 0 &&
204originalText[span.Start - 1] == '\r')
207if (span.Start < originalText.Length && originalText[span.Start] == '\n')
210span = TextSpan.FromBounds(span.Start + 1, Math.Max(span.Start + 1, span.End));
225span = TextSpan.FromBounds(Math.Min(span.Start, span.End - 1), span.End - 1);
286if (editSpan.Length == 0 && editSpan.Start == protectedSpan.End)
289return editSpan.Start < protectedSpan.End && editSpan.End > protectedSpan.Start;
305var overlapsStart = change.Span.Start <= protectedSpan.Start;
319var beforeSpan = TextSpan.FromBounds(change.Span.Start, protectedSpan.Start);
331var overlapText = originalText.ToString(TextSpan.FromBounds(protectedSpan.Start, change.Span.End));
336TextSpan.FromBounds(change.Span.Start, protectedSpan.Start),
341var overlapText = originalText.ToString(TextSpan.FromBounds(change.Span.Start, protectedSpan.End));
428newSpans.Min(span => span.Start),
432var startToken = forkedRoot.FindToken(newSpan.Start);
435startToken.FullSpan.Start,
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (19)
38var currentStart = accumulatedTextChangeSoFar.Value.Span.Start;
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength;
69if (newChange.Span.Start < currentStart)
71currentStart = newChange.Span.Start;
97currentNewEnd = newChange.Span.Start + newChange.NewLength;
162else if (newChange.SpanEnd <= oldChange.Span.Start + oldDelta)
180else if (newChange.SpanStart < oldChange.Span.Start + oldDelta)
199var newChangeLeadingDeletion = oldChange.Span.Start + oldDelta - newChange.SpanStart;
201newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newChange.SpanLength - newChangeLeadingDeletion, newChange.NewLength);
204else if (newChange.SpanStart > oldChange.Span.Start + oldDelta)
222var oldChangeLeadingInsertion = newChange.SpanStart - (oldChange.Span.Start + oldDelta);
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion));
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
311newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newDeletion, newChange.NewLength);
388if (last.Span.End == change.Span.Start)
391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
394else if (last.Span.End > change.Span.Start)
430: this(range.Span.Start, range.Span.Length, range.NewLength)
435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (12)
161if (operationSpan.Start < baseSpan.Start ||
207var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start;
226var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0);
412var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length);
449var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0);
471var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0);
475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
542var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length);
600var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
629var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
651=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
Rename\VisualBasicRenameRewriterLanguageService.vb (4)
97newSpan = New TextSpan(oldSpan.Start, newSpan.Length)
237Me._renameSpansTracker.AddComplexifiedSpan(Me._documentId, oldSpan, New TextSpan(oldSpan.Start, newSpan.Length), Me._modifiedSubSpans)
295AddModifiedSpan(annotation.OriginalSpan, New TextSpan(token.Span.Start, newToken.Span.Length))
304Dim symbols = RenameUtilities.GetSymbolsTouchingPosition(token.Span.Start, _semanticModel, _solution.Services, _cancellationToken)
PatternMatching\PatternMatcher.cs (8)
270var hump = TextSpan.FromBounds(candidateHumps[i].Start, candidateLength);
275matchedSpan: GetMatchedSpan(hump.Start, patternChunk.Text.Length));
440candidate, candidatePart.Start, patternPart.Length,
441pattern, patternPart.Start, patternPart.Length, compareOptions) == 0;
578if (!char.IsUpper(patternChunk.Text[patternHumps[currentPatternHump - 1].Start]) ||
579!char.IsUpper(patternChunk.Text[patternHumps[currentPatternHump].Start]))
590matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length));
600candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
Rename\ConflictEngine\ConflictResolver.Session.cs (12)
222renamedSpansTracker.GetAdjustedPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration),
423var baseToken = baseRoot.FindToken(conflictAnnotation.OriginalSpan.Start, true);
524var adjustedStartPosition = conflictResolution.GetAdjustedTokenStartingPosition(originalReference.TextSpan.Start, originalReference.DocumentId);
525if (newLocations.Any(loc => loc.SourceSpan.Start == adjustedStartPosition))
573var newAdjustedStartPosition = conflictResolution.GetAdjustedTokenStartingPosition(renameDeclarationLocationReference.TextSpan.Start, renameDeclarationLocationReference.DocumentId);
574if (newAdjustedStartPosition != newLocation.SourceSpan.Start)
582var overridingSymbol = await SymbolFinder.FindSymbolAtPositionAsync(solution.GetRequiredDocument(newLocation.SourceTree), newLocation.SourceSpan.Start, cancellationToken: _cancellationToken).ConfigureAwait(false);
633var newReferencedSymbols = RenameUtilities.GetSymbolsTouchingPosition(tokenOrNode.Span.Start, newDocumentSemanticModel, newDocument.Project.Solution.Services, _cancellationToken);
662? conflictResolution.GetAdjustedTokenStartingPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration)
663: _renameSymbolDeclarationLocation.SourceSpan.Start;
886var offset = renameLocation.Location.SourceSpan.Start - containingLocationForStringOrComment.Start;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (19)
38var currentStart = accumulatedTextChangeSoFar.Value.Span.Start;
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength;
69if (newChange.Span.Start < currentStart)
71currentStart = newChange.Span.Start;
97currentNewEnd = newChange.Span.Start + newChange.NewLength;
162else if (newChange.SpanEnd <= oldChange.Span.Start + oldDelta)
180else if (newChange.SpanStart < oldChange.Span.Start + oldDelta)
199var newChangeLeadingDeletion = oldChange.Span.Start + oldDelta - newChange.SpanStart;
201newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newChange.SpanLength - newChangeLeadingDeletion, newChange.NewLength);
204else if (newChange.SpanStart > oldChange.Span.Start + oldDelta)
222var oldChangeLeadingInsertion = newChange.SpanStart - (oldChange.Span.Start + oldDelta);
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion));
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
311newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newDeletion, newChange.NewLength);
388if (last.Span.End == change.Span.Start)
391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
394else if (last.Span.End > change.Span.Start)
430: this(range.Span.Start, range.Span.Length, range.NewLength)
435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (12)
161if (operationSpan.Start < baseSpan.Start ||
207var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start;
226var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0);
412var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length);
449var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0);
471var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0);
475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
542var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length);
600var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
629var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
651=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (19)
38var currentStart = accumulatedTextChangeSoFar.Value.Span.Start;
40var currentNewEnd = accumulatedTextChangeSoFar.Value.Span.Start + accumulatedTextChangeSoFar.Value.NewLength;
69if (newChange.Span.Start < currentStart)
71currentStart = newChange.Span.Start;
97currentNewEnd = newChange.Span.Start + newChange.NewLength;
162else if (newChange.SpanEnd <= oldChange.Span.Start + oldDelta)
180else if (newChange.SpanStart < oldChange.Span.Start + oldDelta)
199var newChangeLeadingDeletion = oldChange.Span.Start + oldDelta - newChange.SpanStart;
201newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newChange.SpanLength - newChangeLeadingDeletion, newChange.NewLength);
204else if (newChange.SpanStart > oldChange.Span.Start + oldDelta)
222var oldChangeLeadingInsertion = newChange.SpanStart - (oldChange.Span.Start + oldDelta);
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion));
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
311newChange = new UnadjustedNewChange(oldChange.Span.Start + oldDelta, newDeletion, newChange.NewLength);
388if (last.Span.End == change.Span.Start)
391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
394else if (last.Span.End > change.Span.Start)
430: this(range.Span.Start, range.Span.Length, range.NewLength)
435private static int NewEnd(this TextChangeRange range) => range.Span.Start + range.NewLength;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (12)
161if (operationSpan.Start < baseSpan.Start ||
207var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start;
226var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0);
412var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length);
449var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0);
471var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0);
475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
542var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length);
600var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
629var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length);
651=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (5)
403return Cast<TDeclarationNode>(AppendTriviaAtPosition(newMember, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
411return Cast<TDeclarationNode>(AppendTriviaAtPosition(newAccessor, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
419return Cast<TDeclarationNode>(AppendTriviaAtPosition(newCompilationUnit, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
427return Cast<TDeclarationNode>(AppendTriviaAtPosition(newParameter, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));
434return Cast<TDeclarationNode>(AppendTriviaAtPosition(newTypeParameter, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode));