1 write to Start
Microsoft.CodeAnalysis (1)
4164 references to Start
AnalyzerRunner (1)
GenerateDocumentationAndConfigFiles (204)
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\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);
Metrics (187)
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\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);
Metrics.Legacy (187)
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\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);
Microsoft.Analyzers.Extra.Tests (4)
Microsoft.Analyzers.Local.Tests (5)
Microsoft.AspNetCore.Analyzer.Testing (2)
Microsoft.AspNetCore.App.Analyzers (30)
Microsoft.AspNetCore.App.Analyzers.Test (5)
Microsoft.AspNetCore.App.CodeFixes (2)
Microsoft.AspNetCore.Components.Analyzers (1)
Microsoft.AspNetCore.Components.Analyzers.Tests (3)
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (3)
Microsoft.CodeAnalysis (111)
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;
Microsoft.CodeAnalysis.Analyzers (207)
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\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);
Microsoft.CodeAnalysis.AnalyzerUtilities (187)
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\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);
Microsoft.CodeAnalysis.BannedApiAnalyzers (205)
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\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);
Microsoft.CodeAnalysis.CodeStyle (202)
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\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);
Microsoft.CodeAnalysis.CodeStyle.Fixes (33)
Microsoft.CodeAnalysis.CSharp (52)
Microsoft.CodeAnalysis.CSharp.CodeStyle (27)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (31)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (34)
StringCopyPaste\KnownSourcePasteProcessor.cs (7)
188edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd));
192edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd));
213edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace));
231if (beforeSelection && interpolation.Span.End > _selectionSpanBeforePaste.Start)
234if (!beforeSelection && interpolation.Span.Start < _selectionSpanBeforePaste.End)
238edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd)));
257TextBeforePaste.GetLineAndOffset(_selectionSpanBeforePaste.Start, out var line, out var offset);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (11)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Features (111)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (9)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (9)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (42)
Diagnostics\DiagnosticTest.cs (13)
2360Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "public class").Start));
2361Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "public static").Start));
2362Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "public static").Start));
2363Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "int x").Start));
2364Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "int x").Start));
2365Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "int y").Start));
2366Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "int y").Start));
2367Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "int z").Start));
2368Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "int z").Start));
2389Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "static void").Start));
2390Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "var x").Start));
2391Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "var y").Start));
2407Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "static void").Start));
LexicalAndXml\LexicalTests.cs (12)
3981Assert.Equal(16, trivia.Span.Start);
3986Assert.Equal(18, trivia.Span.Start);
4026Assert.Equal(16, trivia2.Span.Start);
4031Assert.Equal(18, trivia3.Span.Start);
4036Assert.Equal(33, trivia4.Span.Start);
4059Assert.Equal(16, trivia2.Span.Start);
4064Assert.Equal(18, trivia3.Span.Start);
4110Assert.Equal(19, trivia.Span.Start);
4115Assert.Equal(21, trivia.Span.Start);
4145Assert.Equal(19, trivia2.Span.Start);
4150Assert.Equal(21, trivia3.Span.Start);
4155Assert.Equal(36, trivia4.Span.Start);
Microsoft.CodeAnalysis.CSharp.Workspaces (38)
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);
868var token = await tree.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false);
896var token = await location.SourceTree!.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false);
973implicitReferenceLocation.Location.SourceSpan.Start, cancellationToken, findInsideTrivia: false).ConfigureAwait(false);
Microsoft.CodeAnalysis.EditorFeatures (50)
CommentSelection\AbstractToggleBlockCommentBase.cs (22)
151var trackingSpan = TextSpan.FromBounds(intersectingBlockComments.First().Start, intersectingBlockComments.Last().End);
232if (blockCommentSelection.IsLocationCommented(selectedSpan.Start) && !startsWithCommentMarker)
234InsertText(textChanges, selectedSpan.Start, commentInfo.BlockCommentEndString);
235InsertText(textChanges, selectedSpan.Start, commentInfo.BlockCommentStartString);
254InsertText(textChanges, span.Start, commentInfo.BlockCommentStartString);
261DeleteText(textChanges, new TextSpan(spanToRemove.Start, commentInfo.BlockCommentStartString.Length));
301for (var i = span.Start; i < span.End; i++)
361var selectedLine = snapshot.GetLineFromPosition(SelectedSpan.Start);
362var lineStartToCaretIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(selectedLine.Start, SelectedSpan.Start));
363var caretToLineEndIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, selectedLine.End));
367&& SelectedSpan.Start < blockComment.Start
368&& snapshot.AreOnSameLine(SelectedSpan.Start, blockComment.Start))
370if (IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, blockComment.Start)))
377&& SelectedSpan.Start > blockComment.End
378&& snapshot.AreOnSameLine(SelectedSpan.Start, blockComment.End))
380if (IsSpanWhitespace(TextSpan.FromBounds(blockComment.End, SelectedSpan.Start)))
407var spanStart = SelectedSpan.Start;
410if (commentedSpan.Start > spanStart)
413var possibleUncommentedSpan = TextSpan.FromBounds(spanStart, commentedSpan.Start);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (35)
Microsoft.CodeAnalysis.EditorFeatures.Text (3)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (16)
RenameTracking\RenameTrackingTaggerProviderTests.cs (5)
381state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "cation");
395state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Complex");
409state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Dog");
429state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "_");
853state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Go");
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (3)
Microsoft.CodeAnalysis.ExternalAccess.Copilot (1)
Microsoft.CodeAnalysis.Features (188)
Microsoft.CodeAnalysis.Features.Test.Utilities (3)
Microsoft.CodeAnalysis.Features.UnitTests (1)
Microsoft.CodeAnalysis.InteractiveHost (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol (23)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (204)
Microsoft.CodeAnalysis.PublicApiAnalyzers (187)
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\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);
Microsoft.CodeAnalysis.ResxSourceGenerator (187)
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\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);
Microsoft.CodeAnalysis.Test.Utilities (3)
Microsoft.CodeAnalysis.UnitTests (20)
Microsoft.CodeAnalysis.VisualBasic (64)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (9)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (13)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (3)
Microsoft.CodeAnalysis.VisualBasic.Features (51)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (2)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (26)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (24)
1844Assert.True(syntax.SpanStart = tpSymbol1.Locations.Item(0).SourceSpan.Start OrElse
1845syntax.SpanStart = tpSymbol1.Locations.Item(1).SourceSpan.Start,
1853Assert.True(syntax.SpanStart = tpSymbol2.Locations.Item(0).SourceSpan.Start OrElse
1854syntax.SpanStart = tpSymbol2.Locations.Item(1).SourceSpan.Start,
1862Assert.True(syntax.SpanStart = tpSymbol3.Locations.Item(0).SourceSpan.Start OrElse
1863syntax.SpanStart = tpSymbol3.Locations.Item(1).SourceSpan.Start,
1871Assert.True(syntax.SpanStart = tpSymbol4.Locations.Item(0).SourceSpan.Start OrElse
1872syntax.SpanStart = tpSymbol4.Locations.Item(1).SourceSpan.Start,
2017Assert.True(syntax.SpanStart = varSymbol1.Locations.Item(0).SourceSpan.Start OrElse
2018syntax.SpanStart = varSymbol1.Locations.Item(1).SourceSpan.Start,
2027Assert.True(syntax.SpanStart = varSymbol2.Locations.Item(0).SourceSpan.Start OrElse
2028syntax.SpanStart = varSymbol2.Locations.Item(1).SourceSpan.Start,
2037Assert.True(syntax.SpanStart = varSymbol3.Locations.Item(0).SourceSpan.Start OrElse
2038syntax.SpanStart = varSymbol3.Locations.Item(1).SourceSpan.Start,
2047Assert.True(syntax.SpanStart = varSymbol4.Locations.Item(0).SourceSpan.Start OrElse
2048syntax.SpanStart = varSymbol4.Locations.Item(1).SourceSpan.Start,
2057Assert.True(syntax.SpanStart = varSymbol5.Locations.Item(0).SourceSpan.Start OrElse
2058syntax.SpanStart = varSymbol5.Locations.Item(1).SourceSpan.Start,
2067Assert.True(syntax.SpanStart = varSymbol6.Locations.Item(0).SourceSpan.Start OrElse
2068syntax.SpanStart = varSymbol6.Locations.Item(1).SourceSpan.Start,
2078Assert.True(syntax.SpanStart = varSymbol7.Locations.Item(0).SourceSpan.Start OrElse
2079syntax.SpanStart = varSymbol7.Locations.Item(1).SourceSpan.Start,
2088Assert.True(syntax.SpanStart = varSymbol8.Locations.Item(0).SourceSpan.Start OrElse
2089syntax.SpanStart = varSymbol8.Locations.Item(1).SourceSpan.Start,
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (40)
TestSyntaxNodes.vb (38)
223Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start)
229Assert.Equal(list(i - 1).FullSpan.End, list(i).FullSpan.Start)
232Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start)
245Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start)
251Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start)
267Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start)
273Assert.Equal(list(i - 1).FullSpan.End, list(i).FullSpan.Start)
276Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start)
291Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start)
297Assert.Equal(list(i - 1).FullSpan.End, list(i).FullSpan.Start)
300Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start)
310Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start)
316Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start)
335Assert.Equal(tree.SpanStart, tree.FullSpan.Start)
337VerifyListSpans(precedingTrivia, New TextSpan(tree.FullSpan.Start, (tree.SpanStart - tree.FullSpan.Start)))
360Assert.Equal(tree.SpanStart, tree.FullSpan.Start)
362VerifyListSpans(precedingTrivia, New TextSpan(tree.FullSpan.Start, (tree.SpanStart - tree.FullSpan.Start)))
412VerifyListSpans(statements, TextSpan.FromBounds(statements(0).FullSpan.Start, statements(statements.Count - 1).FullSpan.End))
596Assert.Equal(start, seplist(0).FullSpan.Start)
686Assert.Equal(0, tok.FullSpan.Start)
702Assert.Equal(0, tok.FullSpan.Start)
710Assert.Equal(1, follTrivia(0).FullSpan.Start)
716Assert.Equal(4, follTrivia(1).FullSpan.Start)
729Assert.Equal(0, tok.FullSpan.Start)
741Assert.Equal(0, precTrivia(0).FullSpan.Start)
747Assert.Equal(4, precTrivia(1).FullSpan.Start)
753Assert.Equal(6, precTrivia(2).FullSpan.Start)
762Assert.Equal(10, follTrivia(0).FullSpan.Start)
935Dim i = span1.Start.CompareTo(span2.Start)
2299invalidSpan = New TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (8)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (34)
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)
Microsoft.CodeAnalysis.Workspaces (298)
PatternMatching\PatternMatcher.cs (8)
257var hump = TextSpan.FromBounds(candidateHumps[i].Start, candidateLength);
262matchedSpan: GetMatchedSpan(hump.Start, patternChunk.Text.Length));
438candidate, candidatePart.Start, patternPart.Length,
439pattern, patternPart.Start, patternPart.Length, compareOptions) == 0;
576if (!char.IsUpper(patternChunk.Text[patternHumps[currentPatternHump - 1].Start]) ||
577!char.IsUpper(patternChunk.Text[patternHumps[currentPatternHump].Start]))
588matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length));
598candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
Rename\ConflictEngine\ConflictResolver.Session.cs (12)
220renamedSpansTracker.GetAdjustedPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration),
418var baseToken = baseRoot.FindToken(conflictAnnotation.OriginalSpan.Start, true);
545var adjustedStartPosition = conflictResolution.GetAdjustedTokenStartingPosition(originalReference.TextSpan.Start, originalReference.DocumentId);
546if (newLocations.Any(loc => loc.SourceSpan.Start == adjustedStartPosition))
594var newAdjustedStartPosition = conflictResolution.GetAdjustedTokenStartingPosition(renameDeclarationLocationReference.TextSpan.Start, renameDeclarationLocationReference.DocumentId);
595if (newAdjustedStartPosition != newLocation.SourceSpan.Start)
603var overridingSymbol = await SymbolFinder.FindSymbolAtPositionAsync(solution.GetRequiredDocument(newLocation.SourceTree), newLocation.SourceSpan.Start, cancellationToken: _cancellationToken).ConfigureAwait(false);
654var newReferencedSymbols = RenameUtilities.GetSymbolsTouchingPosition(tokenOrNode.Span.Start, newDocumentSemanticModel, newDocument.Project.Solution.Services, _cancellationToken);
681? conflictResolution.GetAdjustedTokenStartingPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration)
682: _renameSymbolDeclarationLocation.SourceSpan.Start;
901var offset = renameLocation.Location.SourceSpan.Start - containingLocationForStringOrComment.Start;
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\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);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Microsoft.CodeAnalysis.Workspaces.UnitTests (8)
Microsoft.Gen.ComplianceReports.Unit.Tests (4)
Microsoft.Gen.ContextualOptions.Unit.Tests (4)
Microsoft.Gen.Logging.Unit.Tests (4)
Microsoft.Gen.MetadataExtractor.Unit.Tests (4)
Microsoft.Gen.Metrics.Unit.Tests (4)
Microsoft.Gen.MetricsReports.Unit.Tests (4)
Microsoft.Interop.LibraryImportGenerator (1)
Microsoft.Maui.Controls.BindingSourceGen (1)
Microsoft.ML.InternalCodeAnalyzer (2)
Microsoft.VisualStudio.LanguageServices (47)
Venus\ContainedDocument.cs (29)
287if (change.Span.End < visibleSpan.Start)
335if (change.Span.End <= visibleTextSpan.Start)
340if (visibleTextSpan.End <= change.Span.Start)
354var offsetInOriginalText = changeInOriginalText.Span.Start;
508var visibleFirstLineInOriginalText = originalText.Lines.GetLineFromPosition(visibleSpanInOriginalText.Start);
519var snippetInRightText = rightText.Substring(spanInRightText.Start, spanInRightText.Length);
558if (spanInOriginalText.Start < visibleSpanInOriginalText.Start &&
559visibleSpanInOriginalText.Start <= spanInOriginalText.End &&
578if (visibleSpanInOriginalText.Start < spanInOriginalText.Start &&
579spanInOriginalText.Start <= visibleSpanInOriginalText.End &&
583if (spanInOriginalText.Start <= visibleLastLineInOriginalText.Start)
586TextSpan.FromBounds(spanInOriginalText.Start, visibleLastLineInOriginalText.Start),
734visibleSpansInOriginal[currentVisibleSpanIndex].End < change.Span.Start)
832var current = root.FindToken(visibleTextSpan.Start).Parent;
835if (current.Span.Start == visibleTextSpan.Start)
837var blockType = GetRazorCodeBlockType(visibleSpan.Start);
841return new BaseIndentationFormattingRule(root, TextSpan.FromBounds(visibleSpan.Start, end), baseIndentation, _vbHelperFormattingRule);
845if (current.Span.Start < visibleSpan.Start)
847var blockType = GetRazorCodeBlockType(visibleSpan.Start);
851return new BaseIndentationFormattingRule(root, TextSpan.FromBounds(visibleSpan.Start, end), baseIndentation, _vbHelperFormattingRule);
890var startingLine = text.Lines.GetLineFromPosition(span.Start);
913var start = visibleSpan.Start;
936var firstLine = text.Lines.GetLineFromPosition(visibleSpan.Start);
958var type = GetRazorCodeBlockType(span.Start);
975if (token.Span.Start == end && service != null)
Microsoft.VisualStudio.LanguageServices.CSharp (7)
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Microsoft.VisualStudio.LanguageServices.UnitTests (9)
Microsoft.VisualStudio.LanguageServices.VisualBasic (4)
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Roslyn.Diagnostics.Analyzers (205)
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\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);
Roslyn.Diagnostics.CSharp.Analyzers (21)
Roslyn.Diagnostics.VisualBasic.Analyzers (9)
System.Text.RegularExpressions.Generator (1)
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (1)
Test.Utilities (187)
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\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);
Text.Analyzers (204)
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\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);