1 write to Start
Microsoft.CodeAnalysis (1)
Text\TextSpan.cs (1)
34Start = start;
1725 references to Start
AnalyzerRunner (1)
DiagnosticAnalyzerRunner.cs (1)
206.ThenBy(tuple => tuple.Item2.Location.SourceSpan.Start)
Microsoft.Analyzers.Extra.Tests (4)
Resources\RoslynTestUtils.cs (4)
269if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 273else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Analyzers.Local.Tests (5)
InternalReferencedInPublicDocAnalyzerTests.cs (1)
471var text = source.Substring(location.SourceSpan.Start, location.SourceSpan.Length);
Resources\RoslynTestUtils.cs (4)
270if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 274else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.AspNetCore.Analyzer.Testing (2)
DiagnosticAnalyzerRunner.cs (1)
113return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
DiagnosticVerifier.cs (1)
131return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Microsoft.AspNetCore.App.Analyzers (30)
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxHelpers.cs (1)
26=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNode.cs (2)
66return span.Value.Start; 102start = Math.Min(token.VirtualChars[0].Span.Start, start);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxToken.cs (1)
68var start = VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start;
Infrastructure\RoutePattern\RoutePatternLexer.cs (1)
68=> TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End);
Infrastructure\RoutePattern\RoutePatternParser.cs (1)
621: new TextSpan(token.VirtualChars[0].Span.Start, 0);
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (5)
82Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 86Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 87currentVC.Span.Start == token.SpanStart + 2, "First span should start on the second or third char of the string."); 95Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 104Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching.");
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (3)
219var lineStart = lineSpan.Start; 226? lineSpan.Start + indentationLength 334runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End)));
Infrastructure\VirtualChars\VirtualCharSequence.Chunks.cs (2)
54if (position < _array[0].Span.Start || position >= _array[_array.Count - 1].Span.End) 60if (position < ch.Span.Start)
Infrastructure\VirtualChars\VirtualCharSequence.cs (6)
56if (span.Start > sequence.Length) 78public VirtualChar this[int index] => _leafCharacters[_span.Start + index]; 91=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length)); 215Debug.Assert(_span.End == virtualChars._span.Start); 229TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (2)
259properties.Add(StartKey, textChange.Span.Start.ToString(CultureInfo.InvariantCulture)); 515? parentOpt.Value.GetLocation().SourceSpan.Start
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (1)
96while (position <= token.SpanStart && root.FullSpan.Start < token.SpanStart);
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (2)
138properties.Add(StartKey, textChange.Span.Start.ToString(CultureInfo.InvariantCulture)); 361? parentOpt.GetSpan().Start
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (3)
295var chainAndTriviaLength = methodLocation.SourceSpan.Start - location.SourceSpan.Start; 298methodLocation.SourceSpan.Start,
Microsoft.AspNetCore.App.Analyzers.Test (5)
RouteEmbeddedLanguage\Infrastructure\CompletionTestHelpers.cs (1)
26Assert.Equal(cursorPosition, results.CompletionListSpan.Start);
RouteEmbeddedLanguage\Infrastructure\MarkupTestFile.cs (2)
215builder.Sort((left, right) => left.Start - right.Start);
RouteEmbeddedLanguage\RoutePatternClassifierTests.cs (2)
32var actualOrdered = actual.OrderBy(t1 => t1.TextSpan.Start).ToList(); 33var actualFormatted = actualOrdered.Select(a => new FormattedClassification(rewrittenCode.Substring(a.TextSpan.Start, a.TextSpan.Length), a.ClassificationType)).ToArray();
Microsoft.AspNetCore.App.CodeFixes (2)
Dependencies\AddPackageFixer.cs (1)
83var position = diagnostic.Location.SourceSpan.Start;
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
41var token = root.FindToken(span.Start);
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
38var declaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<PropertyDeclarationSyntax>().First();
Microsoft.AspNetCore.Components.Analyzers.Tests (3)
Helpers\CodeFixVerifier.Helper.cs (2)
43var oldArray = diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray(); 44var newArray = newDiagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Helpers\DiagnosticVerifier.Helper.cs (1)
97return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
38var declaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<PropertyDeclarationSyntax>().First();
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (3)
Helpers\CodeFixVerifier.Helper.cs (2)
43var oldArray = diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray(); 44var newArray = newDiagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Helpers\DiagnosticVerifier.Helper.cs (1)
97return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Microsoft.CodeAnalysis (112)
Compilation\Compilation.cs (1)
3537MarkImportDirectiveAsUsed(node.SyntaxTree, node.Span.Start);
Diagnostic\SourceLocation.cs (1)
130return base.GetDebuggerDisplay() + "\"" + _syntaxTree.ToString().Substring(_span.Start, _span.Length) + "\"";
DiagnosticAnalyzer\AnalysisContextInfo.cs (2)
125var lastEnd = node.Span.Start; 129if (token.Span.Start - lastEnd > 0)
DiagnosticAnalyzer\AnalysisScope.cs (1)
170if (filterSpan.GetValueOrDefault().Start == 0 && filterSpan.GetValueOrDefault().Length == filterFile.GetValueOrDefault().SourceTree!.Length)
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
2336syntaxTree.IsHiddenPosition(span.Start);
Syntax\LineDirectiveMap.cs (1)
51var unmappedStartPos = sourceText.Lines.GetLinePosition(span.Start);
Syntax\SyntaxDiffer.cs (8)
111int start = change.Range.Span.Start + delta; 577if (last.Range.Span.End == change.Range.Span.Start) 581new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + change.Range.Span.Length), last.Range.NewLength + change.Range.NewLength), 587Debug.Assert(change.Range.Span.Start >= last.Range.Span.End); 598if (last.Range.Span.End == textChangeRange.Span.Start) 604new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + textChangeRange.Span.Length), last.Range.NewLength + textChangeRange.NewLength), 610Debug.Assert(textChangeRange.Span.Start >= last.Range.Span.End); 763new TextSpan(range.Span.Start + commonLeadingCount, range.Span.Length - (commonLeadingCount + commonTrailingCount)),
Syntax\SyntaxList`1.cs (2)
167return TextSpan.FromBounds(this[0].FullSpan.Start, this[this.Count - 1].FullSpan.End); 185return TextSpan.FromBounds(this[0].Span.Start, this[this.Count - 1].Span.End);
Syntax\SyntaxNode.cs (3)
113/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 969var node = FindToken(span.Start, findInsideTrivia) 1535if (position < span.Start && token.HasLeadingTrivia)
Syntax\SyntaxNodeOrToken.cs (1)
245/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>.
Syntax\SyntaxToken.cs (1)
119/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>.
Syntax\SyntaxTree.cs (1)
271isHiddenPosition = GetLineVisibility(span.Start) == LineVisibility.Hidden;
Syntax\SyntaxTreeExtensions.cs (1)
67index += span.Start;
Syntax\SyntaxTrivia.cs (1)
101/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>.
Text\ChangedText.cs (2)
46if (change.Span.Start < position) 49if (change.Span.Start > oldText.Length)
Text\CompositeText.cs (1)
87var sourceIndex = span.Start;
Text\LargeText.cs (4)
184if (span.Start < 0 || span.Start > _length || span.End > _length) 197int chunkIndex = GetIndexFromPosition(span.Start); 198int chunkStartOffset = span.Start - _chunkStartOffsets[chunkIndex];
Text\SourceText.cs (10)
488Debug.Assert(0 <= span.Start && span.Start <= span.End); 508else if (spanLength == this.Length && span.Start == 0) 556int offset = span.Start; 725int position = Math.Max(Math.Min(span.Start, this.Length), 0); 772if (change.Span.Start < position) 777if (change.Span.End <= changeRanges.Last().Span.Start) 796if (change.Span.Start > position) 798var subText = this.GetSubText(new TextSpan(position, change.Span.Start - position)); 908var newPos = range.Span.Start + newPosDelta;
Text\StringBuilderText.cs (1)
85return _builder.ToString(span.Start, span.Length);
Text\StringText.cs (3)
78if (span.Start == 0 && span.Length == this.Length) 83return this.Source.Substring(span.Start, span.Length); 93if (span.Start == 0 && span.End == this.Length)
Text\SubText.cs (12)
25if (span.Start < 0 26|| span.Start >= text.Length 64return UnderlyingText[UnderlyingSpan.Start + position]; 75return UnderlyingText.ToString(GetCompositeSpan(span.Start, span.Length)); 82return new SubText(UnderlyingText, GetCompositeSpan(span.Start, span.Length)); 88UnderlyingText.CopyTo(span.Start, destination, destinationIndex, span.Length); 93int compositeStart = Math.Min(UnderlyingText.Length, UnderlyingSpan.Start + start); 113var startLineInUnderlyingText = _subText.UnderlyingText.Lines.GetLineFromPosition(_subText.UnderlyingSpan.Start); 119var underlyingSpanStart = _subText.UnderlyingSpan.Start; 173var startInUnderlyingText = Math.Max(underlyingTextLine.Start, _subText.UnderlyingSpan.Start); 178var startInSubText = startInUnderlyingText - _subText.UnderlyingSpan.Start; 210var underlyingPosition = position + _subText.UnderlyingSpan.Start;
Text\TextChange.cs (1)
107return $"new TextChange(new TextSpan({Span.Start}, {Span.Length}), {newTextDisplay})";
Text\TextChangeRange.cs (4)
28internal int NewEnd => Span.Start + NewLength; 109if (change.Span.Start < start) 111start = change.Span.Start; 134return $"new TextChangeRange(new TextSpan({Span.Start}, {Span.Length}), {NewLength})";
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;
Text\TextLine.cs (10)
41if (span.Start > text.Length || span.Start < 0 || span.End > text.Length) 49if (span.Start > 0 && !TextUtilities.IsAnyLineBreakCharacter(text[span.Start - 1])) 55if (span.End > span.Start) 67span = new TextSpan(span.Start, span.Length + lineBreakLen); 77return new TextLine(text, span.Start, span.End); 90Debug.Assert(span.Start == 0 || TextUtilities.IsAnyLineBreakCharacter(text[span.Start - 1])); 93return new TextLine(text, span.Start, span.End);
Text\TextLineCollection.cs (1)
57return new LinePositionSpan(GetLinePosition(span.Start), GetLinePosition(span.End));
Text\TextSpan.cs (19)
47public int End => Start + Length; 72return unchecked((uint)(position - Start) < (uint)Length); 86return span.Start >= Start && span.End <= this.End; 102int overlapStart = Math.Max(Start, span.Start); 119int overlapStart = Math.Max(Start, span.Start); 140return span.Start <= this.End && span.End >= Start; 156return unchecked((uint)(position - Start) <= (uint)Length); 170int intersectStart = Math.Max(Start, span.Start); 221return Start == other.Start && Length == other.Length; 235return Hash.Combine(Start, Length); 245return $"[{Start}..{End})"; 253var diff = Start - other.Start;
Microsoft.CodeAnalysis.CodeStyle (184)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (2)
63fileHeaderStart = Math.Min(trivia.FullSpan.Start, fileHeaderStart); 86fileHeaderStart = trivia.FullSpan.Start;
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (4)
72if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 74change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 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), "");
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (3)
153textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 161textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 167textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (2)
132var expressionFirstLine = lines.GetLineFromPosition(parenthesizedExpressionLocation.SourceSpan.Start); 135return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
565if (pragma.Span.End <= diagnostic.Location.SourceSpan.Start)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (2)
49.OrderBy(t => t.Start) 188: TextSpan.FromBounds(sequence.First().Span.Start, sequence.Last().Span.End);
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (1)
256if (intervalTree.HasIntervalThatOverlapsWith(span.Start, span.End))
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
67index += span.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\Collections\ImmutableIntervalTree`1.cs (4)
59values.Sort((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start); 79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisStart = thisSpan.Start; 125var thisStart = thisSpan.Start; 138var thisStart = thisSpan.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.cs (1)
123if (introspector.GetSpan(witness.GetValue(tree, currentNode)).Start <= end)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
59var newNodeStart = introspector.GetSpan(newNode.Value).Start; 73if (newNodeStart < introspector.GetSpan(root.Value).Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (17)
96if (span1.Start < span2.Start) 286if ((span2.Length == 0) || (span1.Start >= span2.End)) 290else if (span1.End <= span2.Start) 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 302if (span1.Start < span2.Start) 306Debug.Assert(lastEnd < span2.Start); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 566if (end < span.Start) 576start = span.Start; 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 603var oldStart = sorted[0].Start; 607var newStart = sorted[i].Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (1)
28=> this.HasIntervalThatIntersectsWith(span.Start, span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (2)
47.ThenByDescending(x => x.section.Span.Start) 85.ThenByDescending(x => x.section.Span.Start) // in event of a further tie, pick entry at the bottom of the file
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (1)
19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (2)
85return span.Value.Start; 118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
82Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 83Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start, 84TrailingTrivia.Length == 0 ? int.MaxValue : TrailingTrivia[0].GetSpan().Start));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
86Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 90Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 91currentVC.Span.Start == token.SpanStart + 2, "First span should start on the second or third char of the string."); 99Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 108Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching.");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
56if (span.Start > sequence.Length) 74public VirtualChar this[int index] => _leafCharacters[_span.Start + index]; 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length)); 197Debug.Assert(_span.End == virtualChars._span.Start); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (2)
20=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 39return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
48var startLineNumber = text.Lines.IndexOf(span.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
305Math.Min(fullSpan.Start, node.SpanStart), 672while (position <= token.SpanStart && root.FullSpan.Start < token.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
104var startLineNumber = text.Lines.IndexOf(span.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextLineExtensions.cs (1)
69for (var i = line.Span.Start; i < line.Span.End; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (8)
31if (span.Start < start) 33start = span.Start; 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 79var startSegmentEnd = Math.Min(span.End, except.Start); 80if (span.Start < startSegmentEnd) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 83var endSegmentStart = Math.Max(span.Start, except.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (2)
59if (token.Span.End <= operation.TextSpan.Start && 337if (operation.TextSpan.IsEmpty && operation.TextSpan.Start == position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (11)
162if (operationSpan.Start < baseSpan.Start || 208var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start; 227var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0); 413var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length); 450var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0); 472var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0); 476DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0)); 601var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length); 630var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length); 652=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (1)
109return new RelativeIndentationData(_formattingContext, InseparableRegionSpan.Start, span, Operation, _effectiveBaseTokenGetter, _indentationDeltaGetter, _baseIndentationGetter, _lazyIndentationDelta);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (7)
48var thisStart = thisSpan.Start; 60var thisStart = thisSpan.Start; 96if (Introspector.GetSpan(currentNode.Value).Start <= start) 132if (resultSpan.Start <= currentNodeSpan.Start && 164Introspector.GetSpan(parentNode.Value).Start == Introspector.GetSpan(currentNode.Value).Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (2)
83var oldText = (change.Span == span) ? originalString : originalString.Substring(change.Span.Start - span.Start, change.Span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
87Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
61get { return this.Root.FullSpan.Start; }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (1)
38return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.StructuredTrivia.cs (1)
43var text = _trivia.ToFullString()[..(token.SpanStart - _trivia.FullSpan.Start)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
261span = new TextSpan(span.Start + i, span.Length - i); 324last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (9)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 152token1 = root.FindToken(span.Start); 157if (span.End < token1.Span.Start) 162if (token2.Span.End < span.Start) 177if (span.Start <= token1.Span.Start) 190var end = token2.Span.Start; 196end = token2.Span.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (1)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 39Contract.ThrowIfFalse(baseToken.Span.End <= textSpan.Start); 41Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (1)
22Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (5)
488if (ContainsOnlyWhitespace(firstToken.FullSpan.Start, firstToken.SpanStart)) 502for (var i = span.Start - this.Token1.Span.End; i < span.Length; i++) 836return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 844return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start); 938var offset = trivia.FullSpan.Start - this.StartPosition;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
249=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (1)
78words.Add(name.Substring(part.Start, part.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (8)
177=> name.Substring(wordSpan.Start, wordSpan.Length); 179private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 180private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 184for (int i = span.Start, n = span.End; i < n; i++) 197for (int i = span.Start, n = span.End; i < n; i++) 410newWords[i] = name[parts[i].Start..parts[i].End];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
27Current = new TextSpan(nameSpan.Start, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (3)
156(node.FullSpan.Start == 0 && _fileBannerMatcher.TryMatch(leadingTriviaToKeep, ref index))) 168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (3)
59if (holes.Any(static (h, position) => h.Span.Contains(position) && position > h.Span.Start, position)) 81if (tokenToRightOrIn.FullSpan.Start != position && tokenToRightOrIn.RawKind != SyntaxFacts.SyntaxKinds.EndOfFileToken) 97return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (3)
66? root.FindToken(textSpan.Start) 67: root.FindTokenOnRightOfPosition(textSpan.Start); 126var position = textSpan.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().Span.End); 459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
264WriteInteger(location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
29writer.WriteInt32(WordSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (13)
20return o1.TextSpan.Start - o2.TextSpan.Start; 26var d = o1.TextSpan.Start - o2.TextSpan.Start; 87var startToken = root.FindToken(textSpan.Start); 97if (textSpan.Start < startToken.SpanStart) 143return root.FullSpan.End == startToken.SpanStart || startToken.FullSpan.End > endToken.FullSpan.Start; 185if (token1.FullSpan.End == token2.FullSpan.Start) 193for (var token = token1.GetNextToken(includeZeroWidth: true); token.FullSpan.End <= token2.FullSpan.Start; token = token.GetNextToken(includeZeroWidth: true)) 304var forwardPosition = token.FullSpan.Start; 312Contract.ThrowIfFalse(parentNode.FullSpan.Start < forwardPosition); 328if (fullSpan.Start < position) 362var startToken = root.FindToken(span.Start).GetPreviousToken();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (1)
33Debug.Assert(span.Start >= start, "Bad generator.");
Microsoft.CodeAnalysis.CodeStyle.Fixes (43)
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (2)
76var position = context.Span.Start; 415var position = diagnostic.Location.SourceSpan.Start;
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
51var ancestors = root.FindToken(span.Start).GetAncestors<SyntaxNode>();
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (2)
30if (!headerFacts.IsOnTypeHeader(root, diagnostic.Location.SourceSpan.Start, fullHeader: true, out var typeDecl)) 39document, new TextSpan(typeName.Value.Span.Start, 0), forRefactoring: false, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (1)
69if (headerFacts.IsOnTypeHeader(semanticDocument.Root, textSpan.Start, fullHeader: true, out _))
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
65var token = root.FindToken(span.Start);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (1)
31var token = root.FindToken(context.Span.Start);
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
38var token = root.FindToken(span.Start);
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
47var ancestors = root.FindToken(span.Start).GetAncestors<SyntaxNode>();
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (1)
53var token = root.FindToken(diagnostic.AdditionalLocations[0].SourceSpan.Start);
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
75foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (2)
40root.FindTrivia(diagnostic.Location.SourceSpan.Start).HasStructure) 85node = editor.OriginalRoot.FindTrivia(location.SourceSpan.Start).GetStructure()!;
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
269return diagnostics.GroupBy(d => syntaxFacts.GetContainingMemberDeclaration(root, d.Location.SourceSpan.Start) ?? root); 362diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start), 372diagnostics.OrderBy(d => d.Location.SourceSpan.Start),
src\Analyzers\Core\CodeFixes\SimplifyBooleanExpression\SimplifyConditionalCodeFixProvider.cs (1)
51diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start).ToImmutableArray(),
src\Analyzers\Core\CodeFixes\SimplifyLinqExpression\SimplifyLinqExpressionCodeFixProvider.cs (1)
42foreach (var diagnostic in diagnostics.OrderByDescending(diagnostics => diagnostics.Location.SourceSpan.Start))
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
59foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (3)
506positionOfRemovedNode = attributeList.FullSpan.Start; 526positionOfRemovedNode = attributeToRemove.FullSpan.Start; 528var previousToken = root.FindToken(attributeToRemove.FullSpan.Start - 1);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (8)
78var location = selectionTrimmed.Start; 184else if (previousToken != default && previousToken.Span.End == commaToken.Span.Start) 198if (tokenToRight == default || tokenToRight.FullSpan.Start == location) 219if (tokenOnLocation.Span.Start >= location) 236var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 309var location = tokenToRightOrIn.Span.Start; 334if (rightNode.Span.Start != location) 538var argumentStartLine = sourceText.Lines.GetLineFromPosition(typedAncestor.Span.Start).LineNumber;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (7)
75if (node.FullSpan.Contains(selection.Start)) 77var selectionStartToken = node.FindToken(selection.Start); 84var beginningNode = node.FindToken(node.Span.Start).Parent; 96return beginningNode.Span.End <= selection.Start || endNode.Span.Start >= selection.End; 104/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 112var start = span.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
66bool OverlapsWithSpan(SyntaxNode n) => spansTree.HasIntervalThatOverlapsWith(n.FullSpan.Start, n.FullSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
138var token = root.FindToken(span.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
147=> !spansTree.HasIntervalThatOverlapsWith(nodeOrToken.FullSpan.Start, nodeOrToken.FullSpan.Length);
Microsoft.CodeAnalysis.CSharp (52)
Binder\Binder_Symbols.cs (2)
1896if (containerResult == 0 && la.SourceTree == lb.SourceTree) return lb.SourceSpan.Start - la.SourceSpan.Start;
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
1075else if (_position < containingSpan.Start || _position > containingSpan.End) //NB: > not >=
Binder\LocalScopeBinder.cs (2)
513if (declaredInThisScope && newLocation.SourceSpan.Start >= local.GetFirstLocation().SourceSpan.Start)
Compilation\CSharpCompilation.cs (9)
2664if (!this.IsImportDirectiveUsed(infoTree, infoSpan.Start)) 2683var node = info.Tree.GetRoot(cancellationToken).FindToken(info.Span.Start, findInsideTrivia: false). 2814return Hash.Combine(Tree, Span.Start); 4552return loc1.SourceSpan.Start - loc2.SourceSpan.Start; 4563return loc1.Span.Start - loc2.Span.Start; 4574return loc1.Span.Start - loc2.Span.Start;
Compilation\CSharpDiagnosticFilter.cs (1)
155var position = location.SourceSpan.Start;
Compilation\CSharpSemanticModel.cs (2)
1330Debug.Assert(position == fullSpan.Start); 2208var binder = this.GetEnclosingBinder(boundExpr.Syntax.Span.Start);
Compilation\SyntaxTreeSemanticModel.cs (1)
2400var position = CheckAndAdjustPosition(location.SourceSpan.Start);
FlowAnalysis\AbstractFlowPass.cs (1)
303return RegionSpan.Contains(span.Start);
FlowAnalysis\ControlFlowPass.cs (2)
342var sourceStart = sourceLocation.SourceSpan.Start; 343var targetStart = node.Label.GetFirstLocation().SourceSpan.Start;
FlowAnalysis\DefiniteAssignment.cs (1)
1217(symbol.TryGetFirstLocation() is var location && (location is null || node.Span.End < location.SourceSpan.Start)))
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
631return new TextSpan(startSpan.Start, originalSpan.Length - (startSpan.Start - originalSpan.Start));
Parser\Blender.cs (2)
125var start = Math.Max(Math.Min(changeRange.Span.Start, lastCharIndex), 0); 156var finalLength = changeRange.NewLength + (changeRange.Span.Start - start);
Symbols\LexicalSortKey.cs (2)
68: this(syntaxRef.SyntaxTree, syntaxRef.Span.Start, compilation) 75: this(location.SourceTree, location.SourceSpan.Start, compilation)
Symbols\RangeVariableSymbol.cs (1)
62SyntaxToken token = _location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start);
Symbols\Source\SourceConstructorSymbolBase.cs (1)
202return -ctorInitializerLength + (position - span.Start);
Symbols\Source\SourceMemberContainerSymbol.cs (5)
1119if (declaration.Declarations.Length >= 1 && position == declaration.Declarations[0].Location.SourceSpan.Start) 1155int distanceFromInitializerStart = position - initializer.Syntax.Span.Start; 3092declaredMembers.DeclarationWithParameters.Span.Contains(declaredMembers.InstanceInitializers[insertAt][0].Syntax.Span.Start)) 3100Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.Span.Start < declaredInitializers[0].Syntax.Span.Start); 3114declaredMembers.DeclarationWithParameters.Span.Contains(g[0].Syntax.Span.Start)));
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (2)
1764if (GetImplementsLocationOrFallback(interface1).SourceSpan.Start > GetImplementsLocationOrFallback(interface2).SourceSpan.Start)
Symbols\Symbol.cs (2)
456wasZeroWidthMatch = loc.SourceSpan.IsEmpty && loc.SourceSpan.End == declarationSpan.Start; 513SyntaxToken token = location.SourceTree.GetRoot().FindToken(location.SourceSpan.Start);
Syntax\CSharpLineDirectiveMap.cs (1)
231var unmappedStartPos = lines.GetLinePosition(span.Start);
Syntax\CSharpSyntaxTree.cs (1)
647=> new(FilePath, GetLinePosition(span.Start, cancellationToken), GetLinePosition(span.End, cancellationToken));
Syntax\NullableContextStateMap.cs (2)
106int index = GetContextStateIndex(span.Start); 108Debug.Assert(context.Position <= span.Start);
Syntax\SyntaxNodeRemover.cs (8)
70int start = span0.Start; 76start = Math.Min(start, span.Start); 344var span = TextSpan.FromBounds(token.Span.Start, node.Span.End); 345var fullSpan = TextSpan.FromBounds(token.FullSpan.Start, node.FullSpan.End); 378var span = TextSpan.FromBounds(node.Span.Start, token.Span.End); 379var fullSpan = TextSpan.FromBounds(node.FullSpan.Start, token.FullSpan.End); 410removedSpan = TextSpan.FromBounds(span.Start, removedSpan.End); 415removedSpan = TextSpan.FromBounds(removedSpan.Start, span.End);
Syntax\SyntaxReplacer.cs (2)
142start = span.Start; 148start = Math.Min(start, span.Start);
Microsoft.CodeAnalysis.CSharp.CodeStyle (27)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
133var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (3)
364var localStatementStart = localStatement.Span.Start; 365var argumentNodeStart = argumentNode.Span.Start; 373var descendentStart = descendentNode.Span.Start;
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
203if (nextToken.Span.Start < ifStatement.Span.End) 205fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (1)
235if (IntervalTree.HasIntervalThatOverlapsWith(span.Start, span.End))
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
134var span = TextSpan.FromBounds(section[0].FullSpan.Start, section.Last().FullSpan.End);
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
247var descendentStart = descendentNode.Span.Start;
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
81TextSpan.FromBounds(typeArgumentList.LessThanToken.Span.End, typeArgumentList.GreaterThanToken.Span.Start))]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (2)
208var lineStart = lineSpan.Start; 215? lineSpan.Start + indentationLength
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
79if (conditionalDirectives.Last().Span.End <= statement.Span.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
560if (!textSpan.Contains(matchSpan.Start))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (7)
34positionBeforeModifiers = token.FullSpan.Start; 206if (position > fullSpan.Start && position < fullSpan.End) 213if (position > fullSpan.Start && position <= fullSpan.End) 232if (position > span.Start && position < span.End) 362for (int i = token.Span.End - 1, n = token.Span.Start; i >= n; i--) 416return (position > span.Start && position < span.End) 462return (position > span.Start && position < span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
157if (span.Start == 0) 162return syntaxTree.GetRoot(cancellationToken).FindTrivia(span.Start - 1, findInsideTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
103return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
129span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 369AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
1132return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (31)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
97var indentation = sourceText.GetLeadingWhitespaceOfLineAtPosition(node.Span.Start);
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
40var token = root.FindToken(diagnosticSpan.Start);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
133if (syntaxTree.IsEntirelyWithinStringLiteral(textLine.Span.Start, out var stringLiteral, cancellationToken)) 222if (tree.IsEntirelyWithinStringLiteral(textLine.Span.Start, cancellationToken))
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (2)
96var enclosingType = semanticModel.GetEnclosingNamedType(span.Start, cancellationToken); 122var memberContainer = matchingMember.ContainingType.ToMinimalDisplayString(semanticModel, span.Start);
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (3)
35if (helpers.IsOnTypeHeader(semanticDocument.Root, textSpan.Start, out var typeDeclaration) || 36helpers.IsBetweenTypeMembers(semanticDocument.Text, semanticDocument.Root, textSpan.Start, out typeDeclaration)) 43var node = semanticDocument.Root.FindToken(textSpan.Start).GetAncestor<TypeSyntax>();
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
53var token = root.FindToken(span.Start);
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
35var token = root.FindToken(diagnosticSpan.Start);
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (2)
106var symbol = model.GetEnclosingSymbol(node.Span.Start, cancellationToken); 213var ancestors = root.FindToken(span.Start).GetAncestors<SyntaxNode>();
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
49var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
53var arrowToken = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
53var questionToken = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
68var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
40var token = root.FindToken(diagnosticSpan.Start);
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
38var token = root.FindToken(diagnosticSpan.Start);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
41var token = syntaxRoot.FindToken(context.Span.Start); 69var defaultToken = syntaxRoot.FindToken(span.Start);
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
122foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseIndexOperatorCodeFixProvider.cs (1)
40foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
43foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
120.Where(a => a.Initializer?.ElementValues.FirstOrDefault()?.Syntax.SpanStart == diagnostic.Location.SourceSpan.Start) 168if (argument.Span.Start == location.SourceSpan.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
206return contextTree?.GetRoot(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (3)
58var line = indenter.Text.Lines.GetLineFromPosition(trivia.FullSpan.Start); 59if (line.GetFirstNonWhitespacePosition() != trivia.FullSpan.Start) 63return new IndentationResult(trivia.FullSpan.Start, 0);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (26)
BlockCommentEditing\BlockCommentEditingCommandHandler.cs (4)
124containsBlockCommentStartString = currentLine.LineNumber == textSnapshot.GetLineFromPosition(blockComment.FullSpan.Start).LineNumber; 144var commentStart = blockComment.FullSpan.Start; 243? blockComment.FullSpan.Start 291if (span.Start < caretPosition && caretPosition < span.End)
CompleteStatement\CompleteStatementCommandHandler.cs (3)
316return (caret >= condition.Span.Start && caret <= condition.Span.End); 448return caretPosition > declaration.Span.Start && caretPosition <= declaration.Span.End; 454&& caretPosition > forStatementSyntax.Initializers.Span.Start
InlineRename\CSharpEditorInlineRenameService.cs (5)
58renameDefinition.Document, semanticModel, textSpan.Start, cancellationToken).ConfigureAwait(true); 113startPosition = surroundingSpanOfInterest.Value.Start; 115startLine = documentText.Lines.GetLineFromPosition(surroundingSpanOfInterest.Value.Start).LineNumber; 123var fallbackStartLine = Math.Max(0, documentText.Lines.GetLineFromPosition(fallbackSpan.Start).LineNumber - NumberOfContextLines); 151startLine = Math.Max(0, documentText.Lines.GetLineFromPosition(fallbackSpan.Start).LineNumber - NumberOfContextLines);
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (1)
127: root.FindTokenOnRightOfPosition(selectionSpan.Start);
RawStringLiteral\RawStringLiteralCommandHandler_Return.cs (2)
226return interpolatedStringExpression.StringEndToken.Span.Start; 240var index = expression.Span.Start;
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (1)
69edit.Insert(textChange.Span.Start, textChange.NewText);
StringCopyPaste\KnownSourcePasteProcessor.cs (2)
235if (!beforeSelection && interpolation.Span.Start < _selectionSpanBeforePaste.End) 239edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd)));
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
252return textBeforePaste.ToString(TextSpan.FromBounds(lastLine.Span.Start, quotePosition));
StringCopyPaste\StringCopyPasteData.cs (1)
107if (selectionSpan.Start > firstOverlappingChar.Value.Span.Start)
StringCopyPaste\StringCopyPasteHelpers.cs (4)
200for (int currentIndex = span.Start, contentEnd = span.End; currentIndex < contentEnd;) 532if (commonIndentPrefix[commonPrefixLength] != text[lineWhitespaceSpan.Start + commonPrefixLength]) 551if (spans.First().Length > 0 && text[spans.First().Start] == '"') 560for (var i = span.Start; i < span.End; i++)
StringCopyPaste\StringInfo.cs (1)
199while (end > interpolatedString.StringEndToken.Span.Start && text[end - 1] == '"')
TextStructureNavigation\CSharpTextStructureNavigatorProvider.cs (1)
85var start = token.Span.Start;
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (11)
CommentSelection\CSharpCommentSelectionTests.cs (1)
132SetupSelection(doc.GetTextView(), doc.SelectedSpans.Select(s => Span.FromBounds(s.Start, s.End)));
ExtractMethod\ExtractMethodMiscellaneousTests.cs (1)
139view.TextBuffer.CurrentSnapshot, testDocument.SelectedSpans[0].Start, testDocument.SelectedSpans[0].Length), isReversed: false);
FixInterpolatedVerbatimString\FixInterpolatedVerbatimStringCommandHandlerTests.cs (1)
67Assert.Equal(expectedSpans.Single().Start, view.Caret.Position.BufferPosition.Position);
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (2)
117Assert.Equal(expectedSpan.Start, actualSpan.Start);
SplitStringLiteral\SplitStringLiteralCommandHandlerTests.cs (3)
84Assert.Equal(originalSelections.Last().Start, view.Caret.Position.BufferPosition.Position); 100Assert.Equal(expectedSpans.Last().Start, view.Caret.Position.BufferPosition.Position); 110Assert.Equal(originalSelections.Last().Start, view.Caret.Position.BufferPosition.Position);
StringCopyPaste\StringCopyPasteCommandHandlerTests.cs (1)
166caretPosition = caretSpan.Start;
TypeInferrer\TypeInferrerTests.cs (2)
35var position = node?.SpanStart ?? textSpan.Start; 74var token = root.FindToken(textSpan.Start);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
PDB\CSharpPDBTestBase.cs (2)
40var startLine = text.Lines.GetLineFromPosition(span.Start); 42var startColumn = span.Start - startLine.Start + 1;
Microsoft.CodeAnalysis.CSharp.Features (107)
BraceMatching\BlockCommentBraceMatcher.cs (1)
54var startBrace = new TextSpan(trivia.FullSpan.Start, "/**".Length);
ChangeSignature\ChangeSignatureFormattingRule.cs (1)
46span = TextSpan.FromBounds(Math.Max(baseToken.Span.End, span.Start), span.End);
CodeRefactorings\SyncNamespace\CSharpSyncNamespaceCodeRefactoringProvider.cs (1)
37var position = span.Start;
Completion\CompletionProviders\ImportCompletion\TypeImportCompletionProvider.cs (1)
60var position = item.Span.Start;
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
147dotLikeToken.Kind() == SyntaxKind.DotDotToken ? dotLikeToken.Span.Start + 1 : dotLikeToken.Span.End),
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (4)
495interpolationInteriorSpans.Add(TextSpan.FromBounds(interpolation.OpenBraceToken.Span.End, interpolation.CloseBraceToken.Span.Start)); 508var startLine = text.Lines.GetLineFromPosition(descendantSpan.Start); 513var start = startLine.GetFirstNonWhitespacePosition() == descendantSpan.Start 515: descendantSpan.Start;
Copilot\CSharpCopilotCodeFixProvider.cs (1)
81var containingMethod = CSharpSyntaxFacts.Instance.GetContainingMethodDeclaration(root, diagnostic.Location.SourceSpan.Start, useFullSpan: false);
Debugging\BreakpointResolver.cs (1)
37var token = tree.GetRoot(cancellationToken).FindToken(location.SourceSpan.Start);
Debugging\CSharpBreakpointResolutionService.cs (1)
36if (tree == null || !BreakpointSpans.TryGetBreakpointSpan(tree, textSpan.Start, cancellationToken, out var span))
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (6)
144if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 161if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 178if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 195if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 233if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 250if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false)
EditAndContinue\BreakpointSpans.cs (9)
86if (candidate.HasValue && breakpointSpan.Value.Start != candidate.Value.Start) 306position <= switchExpression.CloseBraceToken.Span.Start: 308switchArm = switchExpression.Arms.LastOrDefault(arm => position >= arm.FullSpan.Start) ?? switchExpression.Arms.First(); 346if (property.Initializer != null && position >= property.Initializer.FullSpan.Start) 442position > constructorSyntax.ExpressionBody.ArrowToken.Span.Start) 615if (position < doStatement.Statement.Span.Start) 672else if (position < forEachStatement.InKeyword.FullSpan.Start) 684else if (position < forEachStatement.Expression.FullSpan.Start)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (3)
212var position = span.Start; 297Debug.Assert(position == switchExpression.Span.Start); 1943=> (first.Length > 0 && second.Length > 0) ? TextSpan.FromBounds(first.Start, second.End) : (first.Length > 0) ? first : (second.Length > 0) ? second : defaultSpan;
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (2)
74var firstLine = lines.GetLineFromPosition(token.Span.Start); 249var startIndexInclusive = classifiedSpan.TextSpan.Start;
ExtractMethod\CSharpSelectionValidator.cs (3)
550if (textSpan.Start > previousLine.End) 552return TextSpan.FromBounds(textSpan.Start, previousLine.EndIncludingLineBreak); 555return TextSpan.FromBounds(textSpan.Start, previousLine.End);
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
154var startIndex = identifierName.Span.Start - localRoot.Span.Start;
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (3)
38? foundContinuedLoop.GetFirstToken().Span.Start 66return foundReturnableConstruct.GetFirstToken().Span.Start; 69return symbol.Locations.FirstOrDefault()?.SourceSpan.Start ?? 0;
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (1)
109spans[^1] = TextSpan.FromBounds(lastSpan.Start, mod.Span.End);
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
146: TextSpan.FromBounds(explicitName.FullSpan.Start, identifier.FullSpan.End);
InlineHints\CSharpInlineParameterNameHintsService.cs (2)
55buffer.Add((argument.Span.Start, argument, parameter, GetKind(argument.Expression))); 82buffer.Add((argument.Span.Start, argument, parameter, GetKind(argument.Expression)));
SignatureHelp\AttributeSignatureHelpProvider.cs (2)
120currentSpan.Start == SignatureHelpUtilities.GetSignatureHelpSpan(expression.ArgumentList!).Start)
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (2)
124currentSpan.Start == SignatureHelpUtilities.GetSignatureHelpSpan(initializer.ArgumentList).Start)
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (2)
121return TextSpan.FromBounds(conditional.Span.Start, openBracket.FullSpan.End); 146currentSpan.Start != expression.SpanStart)
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (2)
87currentSpan.Start == SignatureHelpUtilities.GetSignatureHelpSpan(expression).Start)
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (2)
175currentSpan.Start == SignatureHelpUtilities.GetSignatureHelpSpan(expression.ArgumentList).Start)
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (2)
141currentSpan.Start == SignatureHelpUtilities.GetSignatureHelpSpan(expression.ArgumentList).Start)
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (2)
112currentSpan.Start == SignatureHelpUtilities.GetSignatureHelpSpan(expression.ArgumentList).Start)
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (1)
50if (currentSpan.Start == parenthesizedExpression.SpanStart)
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
85var line = sourceText.Lines.GetLineFromPosition(triviaSpan.Start);
Snippets\CSharpIntMainSnippetProvider.cs (1)
45var line = sourceText.Lines.GetLineFromPosition(triviaSpan.Start);
Snippets\CSharpSnippetFunctionService.cs (2)
33var token = syntaxTree.FindTokenOnRightOfPosition(switchExpressionSpan.Start, cancellationToken); 56var typeSpan = new TextSpan(caseGenerationLocation.Start + "case ".Length, fullyQualifiedTypeName.Length);
Snippets\CSharpSnippetHelpers.cs (1)
24var line = sourceText.Lines.GetLineFromPosition(triviaSpan.Start);
SplitStringLiteral\InterpolatedStringSplitter.cs (1)
50else if (content.Span.Start >= CursorPosition)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
133var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (3)
364var localStatementStart = localStatement.Span.Start; 365var argumentNodeStart = argumentNode.Span.Start; 373var descendentStart = descendentNode.Span.Start;
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
203if (nextToken.Span.Start < ifStatement.Span.End) 205fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (1)
235if (IntervalTree.HasIntervalThatOverlapsWith(span.Start, span.End))
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
134var span = TextSpan.FromBounds(section[0].FullSpan.Start, section.Last().FullSpan.End);
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
247var descendentStart = descendentNode.Span.Start;
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
81TextSpan.FromBounds(typeArgumentList.LessThanToken.Span.End, typeArgumentList.GreaterThanToken.Span.Start))]));
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
97var indentation = sourceText.GetLeadingWhitespaceOfLineAtPosition(node.Span.Start);
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
40var token = root.FindToken(diagnosticSpan.Start);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
133if (syntaxTree.IsEntirelyWithinStringLiteral(textLine.Span.Start, out var stringLiteral, cancellationToken)) 222if (tree.IsEntirelyWithinStringLiteral(textLine.Span.Start, cancellationToken))
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (2)
96var enclosingType = semanticModel.GetEnclosingNamedType(span.Start, cancellationToken); 122var memberContainer = matchingMember.ContainingType.ToMinimalDisplayString(semanticModel, span.Start);
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (3)
35if (helpers.IsOnTypeHeader(semanticDocument.Root, textSpan.Start, out var typeDeclaration) || 36helpers.IsBetweenTypeMembers(semanticDocument.Text, semanticDocument.Root, textSpan.Start, out typeDeclaration)) 43var node = semanticDocument.Root.FindToken(textSpan.Start).GetAncestor<TypeSyntax>();
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
53var token = root.FindToken(span.Start);
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
35var token = root.FindToken(diagnosticSpan.Start);
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (2)
106var symbol = model.GetEnclosingSymbol(node.Span.Start, cancellationToken); 213var ancestors = root.FindToken(span.Start).GetAncestors<SyntaxNode>();
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
49var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
53var arrowToken = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
53var questionToken = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
68var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
40var token = root.FindToken(diagnosticSpan.Start);
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
38var token = root.FindToken(diagnosticSpan.Start);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
41var token = syntaxRoot.FindToken(context.Span.Start); 69var defaultToken = syntaxRoot.FindToken(span.Start);
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
122foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseIndexOperatorCodeFixProvider.cs (1)
40foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
43foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
120.Where(a => a.Initializer?.ElementValues.FirstOrDefault()?.Syntax.SpanStart == diagnostic.Location.SourceSpan.Start) 168if (argument.Span.Start == location.SourceSpan.Start)
StringIndentation\CSharpStringIndentationService.cs (1)
57if (childSpan.End < textSpan.Start)
Structure\Providers\DisabledTextTriviaStructureProvider.cs (1)
30var startPos = trivia.FullSpan.Start;
Structure\Providers\DocumentationCommentStructureProvider.cs (1)
31var startPos = documentationComment.FullSpan.Start;
Structure\Providers\RegionDirectiveStructureProvider.cs (1)
19var prefixLength = kw.Span.End - simpleDirective.Span.Start;
Structure\Providers\StringLiteralExpressionStructureProvider.cs (1)
50if (sourceText.Lines.GetLineFromPosition(span.Start).LineNumber !=
TaskList\CSharpTaskListService.cs (1)
41var start = trivia.FullSpan.Start + index;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (9)
EditAndContinue\BreakpointSpansTests.cs (6)
59message: $"Expected: [|{source.Substring(expectedSpan.Value.Start, expectedSpan.Value.Length)}|], Actual: [|{source.Substring(breakpointSpan.Start, breakpointSpan.Length)}|]"); 83itemInspector: span => "[|" + source.Substring(span.Start, span.Length) + "|]"); 85var expectedEnvelope = expectedSpans.IsEmpty ? default : TextSpan.FromBounds(expectedSpans[0].Start, expectedSpans[^1].End); 98if (BreakpointSpans.TryGetClosestBreakpointSpan(root, p, minLength: 0, out var span) && span.Start > lastSpan.Start)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (3)
54var expectedText = source.Substring(expected.Start, expected.Length); 55var token = tree.GetRoot().FindToken(expected.Start); 63var actualText = source.Substring(actual.Start, actual.Length);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (9)
Semantics\InitOnlyMemberTests.cs (2)
3159speculativeModel.GetSpeculativeSymbolInfo(p.FullSpan.Start, p, SpeculativeBindingOption.BindAsExpression); 3164speculativeModel.GetSpeculativeTypeInfo(p.FullSpan.Start, p, SpeculativeBindingOption.BindAsExpression);
Semantics\SuppressAccessibilityChecksTests.cs (7)
55var position = invocation.FullSpan.Start; 73var position = invocation.FullSpan.Start; 88var position = invocation.FullSpan.Start; 125var symbolInfo = model.GetSpeculativeSymbolInfo(expr.FullSpan.Start, 175var position = invocation.FullSpan.Start; 234speculativeModel.GetSpeculativeSymbolInfo(p.FullSpan.Start, p, SpeculativeBindingOption.BindAsExpression); 239speculativeModel.GetSpeculativeTypeInfo(p.FullSpan.Start, p, SpeculativeBindingOption.BindAsExpression);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Compilation\UsedAssembliesTests.cs (1)
145var beforeUsings = source.Substring(0, unit.Usings.First().FullSpan.Start);
Symbols\AnonymousTypesSemanticsTests.cs (2)
2124intervals.Sort((x, y) => x.Start.CompareTo(y.Start));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (42)
Diagnostics\DiagnosticTest.cs (13)
2357Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "public class").Start)); 2358Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "public static").Start)); 2359Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "public static").Start)); 2360Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "int x").Start)); 2361Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "int x").Start)); 2362Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "int y").Start)); 2363Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "int y").Start)); 2364Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "int z").Start)); 2365Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "int z").Start)); 2386Assert.Equal(PragmaWarningState.Default, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "static void").Start)); 2387Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "var x").Start)); 2388Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(219), GetSpanIn(syntaxTree, "var y").Start)); 2404Assert.Equal(PragmaWarningState.Disabled, syntaxTree.GetPragmaDirectiveWarningState(MessageProvider.Instance.GetIdForErrorCode(168), GetSpanIn(syntaxTree, "static void").Start));
Diagnostics\LocationsTests.cs (6)
90TextSpan xToCloseBraceSpan = new TextSpan(xSpan.Start, sampleProgram.IndexOf('}') - xSpan.Start + 1); 400Assert.InRange(diag.Location.SourceSpan.End, diag.Location.SourceSpan.Start, syntaxTree.GetText().Length); 465Assert.InRange(diag.Location.SourceSpan.Start, 0, syntaxTree.GetText().Length); 567Assert.Equal(5, diagnostics[0].Location.SourceSpan.Start); 595Assert.Equal(0, diagnostics[0].Location.SourceSpan.Start);
LexicalAndXml\LexicalTests.cs (12)
3980Assert.Equal(16, trivia.Span.Start); 3985Assert.Equal(18, trivia.Span.Start); 4025Assert.Equal(16, trivia2.Span.Start); 4030Assert.Equal(18, trivia3.Span.Start); 4035Assert.Equal(33, trivia4.Span.Start); 4058Assert.Equal(16, trivia2.Span.Start); 4063Assert.Equal(18, trivia3.Span.Start); 4109Assert.Equal(19, trivia.Span.Start); 4114Assert.Equal(21, trivia.Span.Start); 4144Assert.Equal(19, trivia2.Span.Start); 4149Assert.Equal(21, trivia3.Span.Start); 4154Assert.Equal(36, trivia4.Span.Start);
LexicalAndXml\RawStringLiteralLexingTests.cs (2)
223var expectedDiagnosticSpans = spans.Single().Value.OrderBy(d => d.Start); 224var actualDiagnosticsSpans = diagnostics.Select(d => d.Location.SourceSpan).OrderBy(d => d.Start);
Parsing\RoundTrippingTests.cs (1)
66Assert.Equal(prevSpan.End, span.Start);
Syntax\LambdaUtilitiesTests.cs (1)
47var enclosingMethod = (IMethodSymbol)model.GetEnclosingSymbol(span.Value.Start);
Syntax\SyntaxNodeTests.cs (7)
736var position = identifier.Span.Start + 1; 768invalidSpan = new TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End); 975Assert.Equal(26, last.FullSpan.Start); 997Assert.Equal(list1[i].FullSpan.Start, list2[i].FullSpan.Start); 3586Assert.InRange(0, root.FullSpan.Start, root.FullSpan.End); 3591Assert.NotInRange(0, method.FullSpan.Start, method.FullSpan.End);
Microsoft.CodeAnalysis.CSharp.Workspaces (38)
Classification\ClassificationHelpers.cs (1)
501var tokens = SyntaxFactory.ParseTokens(text2, initialTokenPosition: textSpan.Start);
Classification\Worker.cs (3)
87var textSpanStart = _textSpan.Start; 135AddClassification(TextSpan.FromBounds(token.Span.Start, token.Span.End - "u8".Length), type); 166var classificationSpanStart = _textSpan.Start;
Classification\Worker_DocumentationComments.cs (3)
24if (childFullSpan.Start > _textSpan.End) 28else if (childFullSpan.End < _textSpan.Start) 116spanStart = trivia.Span.Start + index;
Formatting\CSharpSyntaxFormattingService.cs (1)
119return tokenEdits.Where(t => t.Span.Start >= token.FullSpan.Start).ToImmutableArray();
OrganizeImports\CSharpOrganizeImportsService.Rewriter.cs (1)
81=> TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.End);
Recommendations\CSharpRecommendationServiceRunner.cs (1)
523return parameterReference.Span.Start >= containingStaticFunction.SpanStart;
Rename\CSharpRenameRewriterLanguageService.cs (6)
111newSpan = new TextSpan(oldSpan.Start, newSpan.Length); 316_renameSpansTracker.AddComplexifiedSpan(_documentId, oldSpan, new TextSpan(oldSpan.Start, newSpan.Length), _modifiedSubSpans); 348var symbols = RenameUtilities.GetSymbolsTouchingPosition(token.Span.Start, _semanticModel, _solution.Services, _cancellationToken); 869var token = await tree.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false); 897var token = await location.SourceTree!.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false); 1002implicitReferenceLocation.Location.SourceSpan.Start, cancellationToken, findInsideTrivia: false).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (2)
208var lineStart = lineSpan.Start; 215? lineSpan.Start + indentationLength
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
79if (conditionalDirectives.Last().Span.End <= statement.Span.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
560if (!textSpan.Contains(matchSpan.Start))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (7)
34positionBeforeModifiers = token.FullSpan.Start; 206if (position > fullSpan.Start && position < fullSpan.End) 213if (position > fullSpan.Start && position <= fullSpan.End) 232if (position > span.Start && position < span.End) 362for (int i = token.Span.End - 1, n = token.Span.Start; i >= n; i--) 416return (position > span.Start && position < span.End) 462return (position > span.Start && position < span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
157if (span.Start == 0) 162return syntaxTree.GetRoot(cancellationToken).FindTrivia(span.Start - 1, findInsideTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
103return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
129span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 369AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
450var interceptsLocationData = new InterceptsLocationData(contentHash, simpleName.FullSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
1132return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
206return contextTree?.GetRoot(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (3)
58var line = indenter.Text.Lines.GetLineFromPosition(trivia.FullSpan.Start); 59if (line.GetFirstNonWhitespacePosition() != trivia.FullSpan.Start) 63return new IndentationResult(trivia.FullSpan.Start, 0);
Microsoft.CodeAnalysis.EditorFeatures (43)
Classification\Semantic\AbstractSemanticOrEmbeddedClassificationViewTaggerProvider.cs (2)
174var changedSpan = new TextSpan(collapsedRange.Span.Start, collapsedRange.NewLength); 178var member = service.GetContainingMemberDeclaration(root, changedSpan.Start);
Classification\Syntactic\SyntacticClassificationTaggerProvider.TagComputer.cs (1)
341? currentSnapshot.GetSpan(changeRange.Value.Span.Start, changeRange.Value.NewLength)
CommentSelection\AbstractCommentSelectionBase.cs (1)
176return snapshot.CreateTrackingSpan(Span.FromBounds(textSpan.Start, textSpan.End), spanTrackingMode);
CommentSelection\AbstractToggleBlockCommentBase.cs (22)
153var trackingSpan = TextSpan.FromBounds(intersectingBlockComments.First().Start, intersectingBlockComments.Last().End); 234if (blockCommentSelection.IsLocationCommented(selectedSpan.Start) && !startsWithCommentMarker) 236InsertText(textChanges, selectedSpan.Start, commentInfo.BlockCommentEndString); 237InsertText(textChanges, selectedSpan.Start, commentInfo.BlockCommentStartString); 256InsertText(textChanges, span.Start, commentInfo.BlockCommentStartString); 263DeleteText(textChanges, new TextSpan(spanToRemove.Start, commentInfo.BlockCommentStartString.Length)); 303for (var i = span.Start; i < span.End; i++) 363var selectedLine = snapshot.GetLineFromPosition(SelectedSpan.Start); 364var lineStartToCaretIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(selectedLine.Start, SelectedSpan.Start)); 365var caretToLineEndIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, selectedLine.End)); 369&& SelectedSpan.Start < blockComment.Start 370&& snapshot.AreOnSameLine(SelectedSpan.Start, blockComment.Start)) 372if (IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, blockComment.Start))) 379&& SelectedSpan.Start > blockComment.End 380&& snapshot.AreOnSameLine(SelectedSpan.Start, blockComment.End)) 382if (IsSpanWhitespace(TextSpan.FromBounds(blockComment.End, SelectedSpan.Start))) 409var spanStart = SelectedSpan.Start; 412if (commentedSpan.Start > spanStart) 415var possibleUncommentedSpan = TextSpan.FromBounds(spanStart, commentedSpan.Start);
Editor\TextEditApplication.cs (1)
42edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (1)
83return Task.FromResult((document.Id, navigationSpan.Start, 0));
ExternalAccess\VSTypeScript\VSTypeScriptNavigationBarItemService.cs (1)
62_threadingContext, workspace, document.Id, navigationSpan.Start, cancellationToken).ConfigureAwait(false);
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (2)
103return new TextSpan(location.TextSpan.Start + index, searchName.Length); 123return new TextSpan(location.TextSpan.Start + position, replacementText.Length);
InlineRename\InlineRenameService.cs (1)
74var renameInfo = await editorRenameService.GetRenameInfoAsync(document, textSpan.Start, cancellationToken).ConfigureAwait(false);
Intents\DeleteParameterIntentProvider.cs (1)
34priorDocument, priorSelection.Start, restrictToDeclarations: false, cancellationToken).ConfigureAwait(false);
Intents\RenameIntentProvider.cs (1)
42var renameInfo = await renameService.GetRenameInfoAsync(priorDocument, priorSelection.Start, cancellationToken).ConfigureAwait(false);
Interactive\InteractiveWorkspace.cs (1)
52edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Interactive\SendToInteractiveSubmissionProvider.cs (1)
72Select(span => new SnapshotSpan(snapshot, span.Start, span.Length));
Navigation\AbstractDefinitionLocationService.cs (1)
117var interceptorSymbol = await semanticFacts.GetInterceptorSymbolAsync(document, span.Start, cancellationToken).ConfigureAwait(false);
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (1)
308if (text.AreOnSameLine(userSpan.Start, snapshotSpan.Start))
Structure\StructureTag.cs (5)
57if (hintSpan.Start < textSpan.Start) 62return Span.FromBounds(hintSpan.Start, textSpan.Start); 66var hintLine = snapshot.GetLineFromPosition(hintSpan.Start);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (35)
AbstractCommandHandlerTestState.cs (7)
81var cursorPosition = cursorDocument.CursorPosition ?? cursorDocument.SelectedSpans.First(ss => ss.IsEmpty).Start; 90Assert.True(cursorPosition == firstSpan.Start || cursorPosition == firstSpan.End 91|| cursorPosition == lastSpan.Start || cursorPosition == lastSpan.End, 101if (cursorPosition == firstSpan.Start || cursorPosition == lastSpan.End) 104boxSelectionStart = new SnapshotPoint(_subjectBuffer.CurrentSnapshot, firstSpan.Start); 106isReversed = cursorPosition == firstSpan.Start; 112boxSelectionEnd = new SnapshotPoint(_subjectBuffer.CurrentSnapshot, lastSpan.Start);
Classification\ClassificationTestHelper.cs (3)
37actualClassificationList.Sort((t1, t2) => t1.TextSpan.Start - t2.TextSpan.Start); 54var text = actualText.Substring(actual.TextSpan.Start, actual.TextSpan.Length);
CommentSelection\AbstractToggleCommentTestBase.cs (2)
38SetupSelection(doc.GetTextView(), doc.SelectedSpans.Select(s => Span.FromBounds(s.Start, s.End))); 55SetupSelection(document.GetTextView(), document.SelectedSpans.Select(s => Span.FromBounds(s.Start, s.End)));
CompleteStatement\AbstractCompleteStatementTests.cs (4)
60output.Insert(span.End, "|]").Insert(span.Start, "[|"), 61output.Insert(span.End, ";$$|]").Insert(span.Start, "[|")); 112var isReversed = selectedSpan.Start == startCaretPosition; 114view.Selection.Select(new SnapshotSpan(view.TextSnapshot, selectedSpan.Start, selectedSpan.Length), isReversed);
Completion\AbstractArgumentProviderTests`1.cs (1)
106? arguments.IndexOf(arguments.Single(argument => argument.FullSpan.Start <= position && argument.FullSpan.End >= position))
DocumentationComments\AbstractDocumentationCommentTests.cs (2)
151var isReversed = selectedSpan.Start == startCaretPosition; 153view.Selection.Select(new SnapshotSpan(view.TextSnapshot, selectedSpan.Start, selectedSpan.Length), isReversed);
GoToAdjacentMember\AbstractGoToAdjacentMemberTests.cs (1)
50Assert.Equal(hostDocument.SelectedSpans.Single().Start, targetPosition.Value);
KeywordHighlighting\AbstractKeywordHighlighterTests.cs (1)
60var position = cursorSpan.Start + i;
ObsoleteSymbol\AbstractObsoleteSymbolTests.cs (1)
40var expectedSpans = workspace.Documents[i].SelectedSpans.OrderBy(s => s.Start);
ReassignedVariable\AbstractReassignedVariableTests.cs (1)
39var expectedSpans = workspace.Documents[i].SelectedSpans.OrderBy(s => s.Start);
TaskList\AbstractTaskListTests.cs (2)
52var line = initialTextSnapshot.GetLineFromPosition(span.Start); 56Assert.Equal(todo.MappedSpan.StartLinePosition.Character, span.Start - line.Start);
TypeInferrer\TypeInferrerTestBase.cs (1)
60if (await CanUseSpeculativeSemanticModelAsync(document, textSpan.Start))
Workspaces\EditorTestHostDocument.cs (2)
135_textView.Selection.Select(new SnapshotSpan(_textView.TextSnapshot, new Span(span.Start, span.Length)), false); 224edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Workspaces\EditorTestWorkspace.cs (7)
275mappedSpans[string.Empty] = mappedSpans[string.Empty].OrderBy(s => s.End).ThenBy(s => -s.Start).ToImmutableArray(); 324var sortedAndNamedSpans = namedSpans.OrderBy(kvp => kvp.Value.Single().Start) 336var spanLocation = spanNameToListMap.Value.Single().Start; 369var span = new Span(matchingSpan.Start, matchingSpan.Length); 385var caretOffsetInSpan = documentWithSpan.CursorPosition.Value - matchingSpan.Start; 422var markupSpanStart = markupSpan.Start; 423var markupSpanEndExclusive = markupSpan.Start + markupSpan.Length;
Microsoft.CodeAnalysis.EditorFeatures.Text (3)
Extensions.SnapshotSourceText.cs (1)
180var editorSpan = new Span(textSpan.Start, textSpan.Length);
Shared\Extensions\TextSpanExtensions.cs (2)
16=> new Span(textSpan.Start, textSpan.Length); 22=> new TextSpan(textSpan.Start + offset, textSpan.Length);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (16)
CodeGeneration\CodeGenerationTests.cs (2)
907var token = semanticModel.SyntaxTree.GetRoot().FindToken(selection.Start); 919var token = SemanticModel.SyntaxTree.GetRoot().FindToken(destSpan.Start);
Completion\CompletionServiceTests.cs (2)
134var token = root.FindToken(result.Start); 143text, startSpan.Start, IsWordCharacter, IsWordCharacter, alwaysExtendEndSpan: true);
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
146Assert.Equal(expectedSpan.Start, actualSpan.Start);
RenameTracking\RenameTrackingTaggerProviderTests.cs (5)
382state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "cation"); 396state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Complex"); 410state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Dog"); 430state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "_"); 854state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Go");
Snippets\RoslynLSPSnippetConvertTests.cs (5)
492var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length)); 497var lspSnippetString = await RoslynLSPSnippetConverter.GenerateLSPSnippetAsync(document, cursorPosition!.Value, placeholders, textChange, stringSpan.Start, CancellationToken.None).ConfigureAwait(false); 509var placeholderText = text.Substring(spans[0].Start, spans[0].Length); 510var placeholders = spans.Select(span => span.Start).ToImmutableArray();
Utilities\PatternMatcherTests.cs (1)
494var actualSpans = flattened.OrderBy(s => s.Start).ToList();
Microsoft.CodeAnalysis.EditorFeatures.Wpf (4)
InlineRename\UI\Adornment\RenameFlyout.xaml.cs (1)
62RenameUserInput.SelectText(_viewModel.StartingSelection.Start, _viewModel.StartingSelection.Length);
Interactive\InteractiveDocumentNavigationService.cs (1)
55var snapshotSpan = new SnapshotSpan(textSnapshot, textSpan.Start, textSpan.Length);
NavigateTo\NavigateToItemDisplay.cs (1)
88new[] { new DescriptionRun((sourceText.Lines.IndexOf(span.Start) + 1).ToString()) })));
Peek\PeekHelpers.cs (1)
51var node = root.FindToken(identifierLocation.SourceSpan.Start).Parent;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (3)
Expansion\AbstractExpansionTest.vb (2)
36Dim node = GetExpressionSyntaxWithSameSpan(root.FindToken(span.Start).Parent, span.End) 41Dim node = GetExpressionSyntaxWithSameSpan(root.FindToken(span.Start).Parent, span.End)
FindReferences\FindReferencesTests.vb (1)
467Return loc.IsInSource AndAlso Not loc.SourceTree.IsHiddenPosition(loc.SourceSpan.Start)
Microsoft.CodeAnalysis.ExternalAccess.Copilot (1)
Internal\Analyzer\CSharp\CSharpCopilotCodeAnalysisService.cs (1)
75var containingMethod = syntaxFacts.GetContainingMethodDeclaration(root, diagnostic.Location.SourceSpan.Start, useFullSpan: false);
Microsoft.CodeAnalysis.Features (175)
AddImport\AbstractAddImportFeatureService.cs (1)
94var node = root.FindToken(span.Start, findInsideTrivia: true)
BraceMatching\IBraceMatchingServiceExtensions.cs (4)
36if (braces1.HasValue && position >= braces1.Value.LeftSpan.Start && position < braces1.Value.LeftSpan.End) 41else if (braces2.HasValue && position > braces2.Value.RightSpan.Start && position <= braces2.Value.RightSpan.End) 46else if (braces2.HasValue && position > braces2.Value.LeftSpan.Start && position <= braces2.Value.LeftSpan.End) 51else if (braces1.HasValue && position >= braces1.Value.RightSpan.Start && position < braces1.Value.RightSpan.End)
ChangeSignature\AbstractChangeSignatureService.cs (3)
96var context = await GetChangeSignatureContextAsync(document, span.Start, restrictToDeclarations: true, cancellationToken).ConfigureAwait(false); 657if (position < parameters.Span.Start) 671if (position <= parameters.GetSeparator(i).Span.Start)
ClassifiedSpansAndHighlightSpanFactory.cs (6)
46var sourceLine = sourceText.Lines.GetLineFromPosition(referenceSpan.Start); 53return TextSpan.FromBounds(Math.Min(firstNonWhitespacePosition, referenceSpan.Start), sourceLine.End); 60start: narrowSpan.Start - widenedSpan.Start, 83new ClassifiedSpan(ClassificationTypeNames.Text, TextSpan.FromBounds(widenedSpan.Start, narrowSpan.Start)),
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (1)
281tuple => tuple.action, tuple => tuple.diagnostic?.Location.SourceSpan.Start ?? 0);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (2)
268if (syntaxTree.GetLineVisibility(span.Start, cancellationToken) == LineVisibility.Hidden) 276var indexOfLine = lines.IndexOf(span.Start);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (4)
132static bool IsPriorSpan(TextSpan span, TextChange textChange) => span.End <= textChange.Span.Start; 133static bool IsFollowingSpan(TextSpan span, TextChange textChange) => span.Start >= textChange.Span.End; 160var newStart = currentSpan.Start + delta; 168currentSpan = new TextSpan(currentSpan.Start, newLength);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (6)
46diagnosticSpan = new TextSpan(diagnosticSpan.Start + spanChange, diagnosticSpan.Length); 73? trivia.FullSpan.End <= currentDiagnosticSpan.Start 74: trivia.FullSpan.Start >= currentDiagnosticSpan.End; 120else if (startToken.FullSpan.Start == 0) 224var subtreeRoot = root.FindNode(new TextSpan(previousOfStart.FullSpan.Start, spanEnd - previousOfStart.FullSpan.Start));
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (3)
125bool shouldIncludeTrivia(SyntaxTrivia t) => isStartToken ? t.FullSpan.End <= diagnosticSpan.Start : t.FullSpan.Start >= diagnosticSpan.End; 209start: Math.Max(0, trivia.Span.Start - 1),
CodeLens\CodeLensReferencesService.cs (5)
118var position = location.SourceSpan.Start; 130var spanStart = token.Span.Start - textLine.Span.Start; 154token.Span.Start, 162referenceSpan.Start, 219var enclosingSymbol = semanticModel.GetEnclosingSymbol(location.SourceSpan.Start, cancellationToken);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (3)
142.Select(changes => new TextSpan(changes.Key.Start, changes.Sum(change => change.NewText!.Length))); 258_text.GetLineAndOffset(previousToken.Span.Start, out var previousLine, out _); 259_text.GetLineAndOffset(currentToken.Span.Start, out var currentLine, out _);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (2)
869return x.Span.Start - y.Span.Start;
Completion\Providers\AbstractAwaitCompletionProvider.cs (1)
214var position = item.Span.Start;
Completion\Providers\AbstractDocCommentCompletionProvider.cs (4)
281var replacementSpan = TextSpan.FromBounds(text[itemSpan.Start - 1] == '<' && beforeCaretText[0] == '<' ? itemSpan.Start - 1 : itemSpan.Start, itemSpan.End); 284var newPosition = replacementSpan.Start + beforeCaretText.Length;
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (2)
253var token = root.FindToken(result.Start); 262text, startSpan.Start, IsWordCharacter, IsWordCharacter, alwaysExtendEndSpan: true);
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
78contextPosition: initializerLocation.SourceSpan.Start,
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (2)
108var displayText = GetDisplayText(method, semanticModel, span.Start); 117span.Start,
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (2)
138var completionItemPosition = completionItem.Span.Start; 199return await IsInImportsDirectiveAsync(document, completionItem.Span.Start, cancellationToken).ConfigureAwait(false);
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (4)
49var lspSnippet = await RoslynLSPSnippetConverter.GenerateLSPSnippetAsync(allChangesDocument, snippetChange.FinalCaretPosition, snippetChange.Placeholders, change, item.Span.Start, cancellationToken).ConfigureAwait(false); 53if (change.Span.Start > item.Span.Start) 55var textSpan = TextSpan.FromBounds(item.Span.Start, change.Span.End);
Completion\Providers\SymbolCompletionItem.cs (1)
199position = item.Span.Start;
Completion\Utilities.cs (2)
31var totalOldSpan = TextSpan.FromBounds(changes.First().Span.Start, changes.Last().Span.End); 40var totalNewSpan = new TextSpan(totalOldSpan.Start, totalOldSpan.Length + sumOfDeltas);
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
86var position = span.Start;
ConvertToInterpolatedString\ConvertRegularStringToInterpolatedStringRefactoringProvider.cs (1)
38var token = root.FindToken(context.Span.Start);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (2)
256var token = root.FindToken(renamedToken.span.Start); 271var position = span.Start;
Debugging\AbstractBreakpointResolver.cs (1)
83var textSpan = new TextSpan(location.SourceSpan.Start, 0);
Debugging\DebugDataTipInfo.cs (1)
24=> Span.Length == 0 && Span.Start == 0 && Text == null;
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (3)
103var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 318var start = token.Span.Start; 359var replaceSpan = new TextSpan(token.Span.Start, 0);
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
315var token = root.FindToken(location.SourceSpan.Start, findInsideTrivia: true);
DocumentSpanExtensions.cs (2)
26workspace, documentSpan.Document.Id, documentSpan.SourceSpan.Start, cancellationToken); 36return tree.IsHiddenPosition(documentSpan.SourceSpan.Start, cancellationToken);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (4)
836var adjustedOldStatementStart = oldBody.ContainsActiveStatementSpan(oldStatementSpan) ? oldStatementSpan.Start : oldBody.Envelope.Start; 1366if (!newEncompassingAncestor.Span.Contains(newStatementSyntaxSpan.Start)) 1371newStatementSyntax = newEncompassingAncestor.FindToken(newStatementSyntaxSpan.Start).Parent; 1577var node = root.FindToken(unmappedActiveStatementSpan.Start).Parent;
EditAndContinue\ActiveStatementsMap.cs (1)
201oldRoot.FullSpan.Contains(unmappedSpan.Start) &&
EditAndContinue\MemberBody.cs (1)
50envelope.Start,
ExtractInterface\AbstractExtractInterfaceService.cs (1)
52var typeAnalysisResult = await AnalyzeTypeAtPositionAsync(document, span.Start, TypeDiscoveryRule.TypeNameOnly, cancellationToken).ConfigureAwait(false);
ExtractMethod\AbstractSyntaxTriviaService.cs (3)
95var triviaAtBeginning = SplitTrivia(tokens[TriviaLocation.BeforeBeginningOfSpan], tokens[TriviaLocation.AfterBeginningOfSpan], t => t.FullSpan.End <= textSpan.Start); 96var triviaAtEnd = SplitTrivia(tokens[TriviaLocation.BeforeEndOfSpan], tokens[TriviaLocation.AfterEndOfSpan], t => t.FullSpan.Start < textSpan.End); 113[TriviaLocation.AfterBeginningOfSpan] = root.FindTokenOnRightOfPosition(textSpan.Start, includeSkipped: false)
ExtractMethod\MethodExtractor.VariableSymbol.cs (11)
174return leftLocation.SourceSpan.Start - rightLocation.SourceSpan.Start; 226Contract.ThrowIfFalse(_localSymbol.Locations[0].SourceSpan.Start != other._localSymbol.Locations[0].SourceSpan.Start); 228return _localSymbol.Locations[0].SourceSpan.Start - other._localSymbol.Locations[0].SourceSpan.Start; 250var token = tree.GetRoot(cancellationToken).FindToken(span.Start); 338Contract.ThrowIfFalse(locationLeft.SourceSpan.Start != locationRight.SourceSpan.Start); 340return locationLeft.SourceSpan.Start - locationRight.SourceSpan.Start;
ExtractMethod\SelectionValidator.cs (5)
89var token1 = root.FindToken(textSpan.Start); 105if (stmt.Span.End < textSpan.Start) 117if (stmt.SpanStart <= textSpan.Start) 149var token1 = root.FindToken(textSpan.Start); 161if (firstStatement == null && stmt.SpanStart >= textSpan.Start)
Formatting\FormattingRuleUtilities.cs (1)
18var position = (span.Start + span.End) / 2;
FullyQualify\AbstractFullyQualifyService.cs (1)
69var node = root.FindToken(span.Start).GetAncestors<SyntaxNode>().First(n => n.Span.Contains(span));
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.cs (2)
201if (!helpers.IsOnTypeHeader(root, textSpan.Start, out var typeDeclaration) && 202!helpers.IsBetweenTypeMembers(sourceText, root, textSpan.Start, out typeDeclaration))
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (1)
187var typeDeclaration = syntaxFacts.GetContainingTypeDeclaration(root, textSpan.Start);
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (1)
285.OrderByDescending(reference => reference.Location.SourceSpan.Start);
MoveToNamespace\AbstractMoveToNamespaceService.cs (2)
55var typeAnalysisResult = await AnalyzeTypeAtPositionAsync(document, span.Start, cancellationToken).ConfigureAwait(false); 232var moveSpan = new TextSpan(container.FullSpan.Start, 0);
NavigateTo\NavigateToUtilities.cs (1)
31var spanStart = item.SourceSpan.Start;
QuickInfo\IndentationHelper.cs (8)
49var startLineNumber = lines.GetLineFromPosition(span.Start).LineNumber; 59if (deletion.Start > span.Start) 61var spanBeforeDeletion = TextSpan.FromBounds(span.Start, Math.Min(span.End, deletion.Start)); 68if (deletion.End > span.Start) 93var startLineNumber = lines.GetLineFromPosition(span.TextSpan.Start).LineNumber; 111if (startLineFirstNonWhitespace is int value && value < span.TextSpan.Start)
QuickInfo\QuickInfoUtilities.cs (1)
37var groups = await descriptionService.ToDescriptionGroupsAsync(semanticModel, span.Start, symbols, options, cancellationToken).ConfigureAwait(false);
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (2)
167var startInclusive = span.Start; 168var endExclusive = span.Start;
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (2)
250var nameToken = root.FindToken(location.SourceSpan.Start); 290var nameToken = root.FindToken(location.SourceSpan.Start);
Shared\Utilities\AnnotatedSymbolMapping.cs (1)
80var token = root.FindToken(location.SourceSpan.Start);
SignatureHelp\SignatureHelpService.cs (1)
96if (bestItems is not null && items.ApplicableSpan.Start < bestItems.ApplicableSpan.Start)
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (1)
48var token = root.FindToken(span.Start, findInsideTrivia: true);
Snippets\RoslynLSPSnippetConverter.cs (3)
35var textChangeStart = textChange.Span.Start; 129var startPosition = textChange.Span.Start; 130var endPosition = textChange.Span.Start + textChangeText.Length;
Snippets\SnippetFunctionService.cs (1)
41var updatedTextSpan = new TextSpan(fieldSpan.Start, fullyQualifiedTypeName.Length);
SolutionCrawler\AbstractDocumentDifferenceService.cs (4)
112var oldMember = syntaxFactsService.GetContainingMemberDeclaration(oldRoot, range.Span.Start); 113var newMember = syntaxFactsService.GetContainingMemberDeclaration(newRoot, range.Span.Start); 153var oldMember = syntaxFactsService.GetContainingMemberDeclaration(oldRoot, range.Span.Start); 154var newMember = syntaxFactsService.GetContainingMemberDeclaration(newRoot, range.Span.Start);
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
55var token = syntaxRoot.FindToken(span.Start);
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (1)
60TextSpan.FromBounds(upperIfOrElseIfSpan.Start, lowerIfOrElseIfSpan.End));
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (1)
67var token = root.FindToken(tokenSpan.Start);
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (2)
63fileHeaderStart = Math.Min(trivia.FullSpan.Start, fileHeaderStart); 86fileHeaderStart = trivia.FullSpan.Start;
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (4)
72if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 74change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 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), "");
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (3)
153textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 161textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 167textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (2)
132var expressionFirstLine = lines.GetLineFromPosition(parenthesizedExpressionLocation.SourceSpan.Start); 135return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
565if (pragma.Span.End <= diagnostic.Location.SourceSpan.Start)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
49.OrderBy(t => t.Start)
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (1)
256if (intervalTree.HasIntervalThatOverlapsWith(span.Start, span.End))
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (2)
76var position = context.Span.Start; 415var position = diagnostic.Location.SourceSpan.Start;
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
51var ancestors = root.FindToken(span.Start).GetAncestors<SyntaxNode>();
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (2)
30if (!headerFacts.IsOnTypeHeader(root, diagnostic.Location.SourceSpan.Start, fullHeader: true, out var typeDecl)) 39document, new TextSpan(typeName.Value.Span.Start, 0), forRefactoring: false, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (1)
69if (headerFacts.IsOnTypeHeader(semanticDocument.Root, textSpan.Start, fullHeader: true, out _))
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
65var token = root.FindToken(span.Start);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (1)
31var token = root.FindToken(context.Span.Start);
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
38var token = root.FindToken(span.Start);
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
47var ancestors = root.FindToken(span.Start).GetAncestors<SyntaxNode>();
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (1)
53var token = root.FindToken(diagnostic.AdditionalLocations[0].SourceSpan.Start);
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
75foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (2)
40root.FindTrivia(diagnostic.Location.SourceSpan.Start).HasStructure) 85node = editor.OriginalRoot.FindTrivia(location.SourceSpan.Start).GetStructure()!;
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
269return diagnostics.GroupBy(d => syntaxFacts.GetContainingMemberDeclaration(root, d.Location.SourceSpan.Start) ?? root); 362diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start), 372diagnostics.OrderBy(d => d.Location.SourceSpan.Start),
src\Analyzers\Core\CodeFixes\SimplifyBooleanExpression\SimplifyConditionalCodeFixProvider.cs (1)
51diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start).ToImmutableArray(),
src\Analyzers\Core\CodeFixes\SimplifyLinqExpression\SimplifyLinqExpressionCodeFixProvider.cs (1)
42foreach (var diagnostic in diagnostics.OrderByDescending(diagnostics => diagnostics.Location.SourceSpan.Start))
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
59foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
Structure\BlockSpan.cs (1)
134var startLine = lines.GetLinePosition(this.TextSpan.Start).Line;
TaskList\AbstractTaskListService.cs (4)
133var startLine = text.Lines.GetLineFromPosition(fullSpan.Start); 140AppendTaskListItemsOnSingleLine(commentDescriptors, document, message, fullSpan.Start, items); 145var startMessage = text.ToString(TextSpan.FromBounds(fullSpan.Start, startLine.End)); 146AppendTaskListItemsOnSingleLine(commentDescriptors, document, startMessage, fullSpan.Start, items);
Wrapping\AbstractCodeActionComputer.cs (1)
179var span = TextSpan.FromBounds(edit.Left.Span.End, edit.Right.Span.Start);
Wrapping\BinaryExpression\BinaryExpressionCodeActionComputer.cs (1)
62OriginalSourceText.GetOffset(binaryExpression.Span.Start)
Wrapping\Edit.cs (1)
26if (left.Span.End > right.Span.Start)
Microsoft.CodeAnalysis.Features.Test.Utilities (3)
EditAndContinue\EditAndContinueTestVerifier.cs (2)
386var result = root.FindToken(span.Start).Parent!; 514.OrderBy(partners => partners.Key.GetLocation().SourceSpan.Start)
Snippets\AbstractSnippetProviderTests.cs (1)
102Assert.Contains(expectedSpan.Start, placeholderPositions);
Microsoft.CodeAnalysis.Features.UnitTests (1)
EditAndContinue\ActiveStatementsMapTests.cs (1)
60Assert.Equal(new Range(5, 6), ActiveStatementsMap.GetSpansStartingInSpan(span.Start, span.End, array, startPositionComparer: (x, y) => x.Start.CompareTo(y)));
Microsoft.CodeAnalysis.InteractiveHost (2)
Interactive\Core\InteractiveHost.Service.cs (2)
782displayedDiagnostics.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
Microsoft.CodeAnalysis.LanguageServer.Protocol (28)
Extensions\ProtocolConversions.cs (1)
504Math.Min(text.Length, span.Start),
Features\Diagnostics\DocumentAnalysisExecutor.cs (1)
315var startNode = service.GetContainingMemberDeclaration(root, span.Value.Start);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (4)
322Contract.ThrowIfFalse(member.FullSpan.Start == oldSpan.Start); 335if (diagnosticSpan.Start < oldSpan.Start) 338if (diagnostic.AdditionalLocations.Any(l => l.DocumentId != null && l.UnmappedFileSpan.GetClampedTextSpan(text).Start >= oldSpan.Start))
Features\UnifiedSuggestions\UnifiedSuggestedActionSetComparer.cs (2)
46var startsDistance = Math.Abs(a.Start - b.Start);
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (2)
77var breakpointSpan = result.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : result.TextSpan; 101breakpointSpan = secondResult.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : secondResult.TextSpan;
Handler\Completion\CompletionHandler.cs (2)
158var defaultSpan = new TextSpan(completionList.Span.Start, length: position - completionList.Span.Start);
Handler\Completion\CompletionResultFactory.cs (1)
706var relativeCaretPosition = caretPosition.Value - completionChangeSpan.Start;
Handler\InlineCompletions\InlineCompletionsHandler.cs (12)
187var snippetEndPosition = textChange.Span.Start + textChange.NewText!.Length; 192var spanToFormat = TextSpan.FromBounds(textChange.Span.Start, snippetEndPosition); 204snippetEndPosition = GetAdjustedSpan(formattingChanges, new TextSpan(snippetEndPosition, 0)).Start; 205var spanContainingFormattedSnippet = TextSpan.FromBounds(snippetShortcut.Start, snippetEndPosition); 216var fieldInSnippetContext = GetTextSpanInContextOfSnippet(fieldInFormattedText.Start, spanContainingFormattedSnippet.Start, fieldInFormattedText.Length); 225var caretInSnippetContext = GetTextSpanInContextOfSnippet(caretInFormattedText.Start, spanContainingFormattedSnippet.Start, caretInFormattedText.Length); 236var textChangesBefore = textChanges.Where(t => t.Span.End <= originalSpan.Start); 238return new TextSpan(originalSpan.Start + amountToAdjust, originalSpan.Length); 272var locationInDefaultSnippet = snippetSpan.Start; 275var locationInFinalSnippet = snippetSpan.Start;
Handler\InlineCompletions\XmlSnippetParser.ParsedXmlSnippet.cs (1)
63var className = await snippetFunctionService.GetContainingClassNameAsync(documentWithSnippet, fieldSpan.Start, cancellationToken).ConfigureAwait(false);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (2)
234Debug.Assert(desiredCaretLocation >= textChange.Span.Start); 235var offsetInTextChange = desiredCaretLocation - textChange.Span.Start;
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
ProtocolConversionsTests.cs (4)
197Assert.Equal(0, textSpan.Start); 211Assert.Equal(21, textSpan.Start); 224Assert.Equal(0, textSpan.Start); 244Assert.Equal(0, textSpan.Start);
SpellCheck\SpellCheckTests.cs (2)
566.OrderBy(t => t.textSpan.Start)) 576ranges[index++] = span.Start - lastSpanEnd;
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\DiagnosticDescription.cs (3)
285if (!_syntaxPredicate(d._location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start, true).Parent)) 298if (!d._syntaxPredicate(_location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start, true).Parent)) 543assertText.AppendLine(l.SourceTree.GetText().Lines.GetLineFromPosition(l.SourceSpan.Start).ToString());
Microsoft.CodeAnalysis.UnitTests (20)
CommonSyntaxTests.cs (2)
120Assert.Equal(8, correctSpan.Start); 157Assert.Equal(8, correctSpan.Start);
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1358expectedSymbols.Add(GetSymbolAtPosition(model, span.Start));
Text\LargeTextTests.cs (2)
162Assert.Equal(start, textLine.Span.Start); 164Assert.Equal(start, textLine.SpanIncludingLineBreak.Start);
Text\SourceTextTests.cs (1)
449Assert.Equal(Text.Substring(span.Start, span.Length), writer.ToString());
Text\StringText_LineTest.cs (2)
89Assert.Equal(start, line.Span.Start); 90Assert.Equal(start, line.SpanIncludingLineBreak.Start);
Text\StringTextTest.cs (2)
115Assert.Equal(start, textLine.Span.Start); 117Assert.Equal(start, textLine.SpanIncludingLineBreak.Start);
Text\StringTextTests_Default.cs (1)
61Assert.Equal(3 + newLine.Length, data.Lines[1].Span.Start);
Text\TextChangeTests.cs (2)
78Assert.Equal(6, changes[0].Span.Start); 1251Assert.True(position <= change.Span.Start);
Text\TextSpanTest.cs (7)
22Assert.Equal(0, span.Start); 31Assert.Equal(1, span.Start); 43Assert.Equal(0, span.Start); 90Assert.Equal(0, span.Start); 101Assert.Equal(0, span.Start); 113Assert.Equal(15, span.Start); 123Assert.Equal(0, span.Start);
Microsoft.CodeAnalysis.VisualBasic (64)
Analysis\FlowAnalysis\AbstractFlowPass.Regions.vb (1)
56Return Me._region.Contains(span.Start)
Analysis\FlowAnalysis\DataFlowPass.vb (1)
1194If isImplicitlyDeclared OrElse firstLocation Is Nothing OrElse firstLocation.SourceSpan.Start < node.SpanStart Then
Binding\Binder_Query.vb (1)
2273operatorNameSpan = TextSpan.FromBounds(operatorNameSpan.Start, right.Span.End)
CommandLine\CommandLineDiagnosticFormatter.vb (1)
61Dim sourceSpanStart = sourceSpan.Start
Compilation\VisualBasicCompilation.vb (3)
1718If Not Me.IsImportDirectiveUsed(infoTree, clauseSpans(0).Start) Then 1729If Not Me.IsImportDirectiveUsed(infoTree, clauseSpan.Start) Then 1764_lazyImportClauseDependencies.TryGetValue((infoTree, clauseSpan.Start), dependencies) Then
Compilation\VisualBasicDiagnosticFilter.vb (1)
205location.SourceTree.GetWarningState(id, location.SourceSpan.Start) = ReportDiagnostic.Suppress Then
GlobalImport.vb (2)
118Dim startindex = unmappedSpan.Start - _clause.Span.Start
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (3)
550Return New Text.TextSpan(startSpan.Start, originalSpan.Length - (startSpan.Start - originalSpan.Start))
Scanner\Blender.vb (10)
94Dim start = NearestStatementThatContainsPosition(root, span.Start, fullSpan) 95Debug.Assert(start.Start <= span.Start) 101Return TextSpan.FromBounds(start.Start, [end].End) 156Dim start = Math.Min(span.Start, Math.Max(0, fullWidth - 1)) 209Dim start = _change.Span.Start 226If position < _change.Span.Start Then 230If position >= _change.Span.Start + _change.NewLength Then 389Dim range = New TextSpan(_affectedRange.Span.Start, _affectedRange.NewLength) 440If _curNodeSpan.Contains(_affectedRange.Span.Start) Then
Scanner\Directives.vb (1)
544startSkipped = skippedSpan.Start
Scanner\Scanner.vb (2)
348If span.Start >= 0 AndAlso span.End <= _bufferLen Then 349Return SyntaxFactory.DisabledTextTrivia(GetTextNotInterned(span.Start, span.Length))
Symbols\LexicalSortKey.vb (9)
101Me.New(syntaxRef.SyntaxTree, syntaxRef.Span.Start, compilation) 114Debug.Assert(location.PossiblyEmbeddedOrMySourceSpan.Start >= 0) 129Me._position = location.PossiblyEmbeddedOrMySourceSpan.Start 188Return first.PossiblyEmbeddedOrMySourceSpan.Start - second.PossiblyEmbeddedOrMySourceSpan.Start 201Return first.Span.Start - second.Span.Start 214Return first.Span.Start - second.Span.Start
Symbols\Source\SourceMemberContainerTypeSymbol.vb (11)
1361Return containingSourceNamespace.GetDeclarationSpelling(firstLocation.SourceTree, firstLocation.SourceSpan.Start) 2264((fileCompResult = 0) AndAlso typeToTestLocation.SourceSpan.Start >= structBeingAnalyzedLocation.SourceSpan.Start) 3263If Me._declaration.Declarations.Length >= 1 AndAlso position = Me._declaration.Declarations(0).Location.SourceSpan.Start Then 3294Dim distanceFromInitializerStart = position - siblingInitializers(index).Syntax.Span.Start 3895If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then 3945If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then 3977If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then
Symbols\Source\SourceMethodSymbol.vb (1)
1217Return localPosition - span.Start
Symbols\Source\SourcePropertySymbol.vb (2)
167Dim accessor = If(getMethod.Locations(0).SourceSpan.Start < setMethod.Locations(0).SourceSpan.Start, setMethod, getMethod)
Symbols\Symbol.vb (1)
373Dim token = CType(location.SourceTree.GetRoot().FindToken(location.SourceSpan.Start), SyntaxToken)
Syntax\SyntaxFacts.vb (1)
1116If p.GetLocation.SourceSpan.Start < token.SpanStart Then
Syntax\SyntaxNodeRemover.vb (8)
49Dim start As Integer = span0.Start 55start = Math.Min(start, span.Start) 239Dim fullSpan = TextSpan.FromBounds(token.FullSpan.Start, node.FullSpan.End) 240Dim span = TextSpan.FromBounds(token.Span.Start, node.Span.End) 263Dim fullSpan = TextSpan.FromBounds(node.FullSpan.Start, token.FullSpan.End) 264Dim span = TextSpan.FromBounds(node.Span.Start, token.Span.End) 285removedSpan = TextSpan.FromBounds(span.Start, removedSpan.End) 288removedSpan = TextSpan.FromBounds(removedSpan.Start, span.End)
Syntax\SyntaxReplacer.vb (2)
120start = span.Start 123start = Math.Min(start, span.Start)
Syntax\VisualBasicLineDirectiveMap.vb (1)
210Dim unmappedStartPos = sourceText.Lines.GetLinePosition(span.Start)
Syntax\VisualBasicSyntaxNode.vb (1)
146''' Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>.
Syntax\VisualBasicSyntaxTree.vb (1)
435Return New FileLinePositionSpan(Me.FilePath, GetLinePosition(span.Start), GetLinePosition(span.End))
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (10)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (2)
141If interpolation.OpenBraceToken.Span.End = node.OpenParenToken.Span.Start AndAlso 142node.OpenParenToken.Span.End = expression.Span.Start Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
415If Not textSpan.Contains(matchSpan.Start) Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (2)
128If (child.FullSpan.Start < position) AndAlso (position <= child.FullSpan.End) Then 283If trivia.Span.Start > position Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (3)
833firstStatement.FullSpan.Start, 834method.EndBlockStatement.FullSpan.Start) 878Return outerSpan.Contains(innerSpan.Start)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (1)
86Return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart)
src\Workspaces\VisualBasic\Portable\Formatting\Rules\BaseFormattingRule.vb (1)
64Return TextSpan.FromBounds(spanStart, trivia.FullSpan.Start)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (13)
src\Analyzers\VisualBasic\CodeFixes\GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (2)
33If headerFacts.IsOnTypeHeader(semanticDocument.Root, textSpan.Start, typeDecl) Then 38Dim token = semanticDocument.Root.FindToken(textSpan.Start)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (2)
63If node.Span.Start = diagnosticSpan.Start AndAlso node.Span.End < diagnosticSpan.End Then
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
58Dim symbol = model.GetEnclosingSymbol(node.Span.Start, cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (3)
384Return Cast(Of TDeclarationNode)(AppendTriviaAtPosition(newMember, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode)) 394Return Cast(Of TDeclarationNode)(AppendTriviaAtPosition(newCompilationUnit, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode)) 403Return Cast(Of TDeclarationNode)(AppendTriviaAtPosition(newParameter, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb (1)
550position = possibleTuple.FullSpan.Start
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (1)
72TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.Indenter.vb (3)
63Dim line = indenter.Text.Lines.GetLineFromPosition(trivia.FullSpan.Start) 64If line.GetFirstNonWhitespacePosition() = trivia.FullSpan.Start Then 65Return New IndentationResult(trivia.FullSpan.Start, 0)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (3)
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
310Dim aligningWhitespace = subjectBuffer.CurrentSnapshot.GetAligningWhitespace(state.TokenToLeft.Parent.Span.Start)
LineCommit\CommitBufferManager.vb (1)
193finalSpanStart = Math.Min(finalSpanStart, startingStatementInfo.TextSpan.Start)
LineCommit\CommitCommandHandler.vb (1)
109Dim selectedSpan = New SnapshotSpan(snapshot, textspan.Start, textspan.Length)
Microsoft.CodeAnalysis.VisualBasic.Features (50)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (1)
67Dim token = root.FindToken(context.Span.Start)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (1)
47Dim token = root.FindToken(context.Span.Start)
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (1)
64Dim token = root.FindToken(span.Start)
CodeFixes\IncorrectFunctionReturnType\IncorrectFunctionReturnTypeCodeFixProvider.vb (1)
47Dim token = root.FindToken(span.Start)
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.vb (1)
49Dim token = root.FindToken(span.Start)
Completion\KeywordRecommenders\PreprocessorDirectives\PreprocessorHelpers.vb (1)
45If child.FullSpan.Start > _maxPosition Then
Debugging\VisualBasicBreakpointService.vb (1)
77Return GetBreakpointAsync(document, textSpan.Start, textSpan.Length, cancellationToken)
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.vb (4)
122If _ignoredSpans IsNot Nothing AndAlso _ignoredSpans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then 134If _ignoredSpans IsNot Nothing AndAlso _ignoredSpans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then 146If _ignoredSpans IsNot Nothing AndAlso _ignoredSpans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then 178If _ignoredSpans IsNot Nothing AndAlso _ignoredSpans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then
EditAndContinue\BreakpointSpans.vb (4)
70If candidate.HasValue AndAlso breakpointSpan.Value.Start <> candidate.Value.Start Then 250Return TextSpan.FromBounds(node.Identifier.Span.Start, node.Initializer.Span.End) 254Return TextSpan.FromBounds(node.Identifier.Span.Start, node.AsClause.Span.End)
EditAndContinue\DeclarationBody\FieldOrPropertyDeclarationBody.vb (1)
88If span.Start = InitializerActiveStatement.SpanStart Then
EditAndContinue\DeclarationBody\FieldWithMultipleAsNewClauseDeclarationBody.vb (2)
37Return TextSpan.FromBounds(_modifedIdentifier.Span.Start, OtherActiveStatementContainer.Span.End) 43Return TextSpan.FromBounds(_modifedIdentifier.Span.End, OtherActiveStatementContainer.Span.Start).Contains(span)
EditAndContinue\DeclarationBody\PropertyWithInitializerDeclarationBody.vb (1)
37Return TextSpan.FromBounds(PropertyStatement.Identifier.Span.Start, PropertyStatement.Initializer.Span.End)
EditAndContinue\DeclarationBody\PropertyWithNewClauseDeclarationBody.vb (1)
37Return TextSpan.FromBounds(PropertyStatement.Identifier.Span.Start, PropertyStatement.AsClause.Span.End)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (3)
136Dim position = span.Start 1257Return TextSpan.FromBounds(newWith.NewKeyword.Span.Start, 1319Return TextSpan.FromBounds(ifKeyword.Span.Start,
ExtractMethod\VisualBasicSelectionValidator.vb (2)
464Dim firstTokenInSelection = root.FindTokenOnRightOfPosition(adjustedSpan.Start, includeSkipped:=False) 656Return TextSpan.FromBounds(textSpan.Start, previousLine.End)
GoToDefinition\VisualBasicGoToDefinitionSymbolService.vb (1)
38Return continueTarget.GetFirstToken().Span.Start
InlineHints\VisualBasicInlineParameterNameHintsService.vb (1)
56buffer.Add((argument.Span.Start, argument, parameter, GetKind(argument.Expression)))
SignatureHelp\AbstractIntrinsicOperatorSignatureHelpProvider.vb (1)
107currentSpan.Start = node.SpanStart Then
SignatureHelp\AttributeSignatureHelpProvider.vb (2)
98currentSpan.Start = SignatureHelpUtilities.GetSignatureHelpSpan(expression.ArgumentList).Start Then
SignatureHelp\CollectionInitializerSignatureHelpProvider.vb (2)
79currentSpan.Start = GetSignatureHelpSpan(expression).Start Then
SignatureHelp\FunctionAggregationSignatureHelpProvider.vb (1)
36functionAggregation.SpanStart = currentSpan.Start Then
SignatureHelp\GenericNameSignatureHelpProvider.vb (2)
36currentSpan.Start = SignatureHelpUtilities.GetSignatureHelpSpan(expression.TypeArgumentList).Start Then
SignatureHelp\InvocationExpressionSignatureHelpProvider.vb (2)
37currentSpan.Start = GetSignatureHelpSpan(expression.ArgumentList).Start Then
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.vb (2)
36currentSpan.Start = SignatureHelpUtilities.GetSignatureHelpSpan(expression.ArgumentList).Start Then
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (1)
35currentSpan.Start = statement.Name.SpanStart Then
Snippets\VisualBasicSnippetFunctionService.vb (2)
31Dim token = syntaxTree.FindTokenOnRightOfPosition(switchExpressionSpan.Start, cancellationToken) 47Dim typeSpan = New TextSpan(caseGenerationLocation.Start + "Case ".Length, fullyQualifiedTypeName.Length)
src\Analyzers\VisualBasic\CodeFixes\GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (2)
33If headerFacts.IsOnTypeHeader(semanticDocument.Root, textSpan.Start, typeDecl) Then 38Dim token = semanticDocument.Root.FindToken(textSpan.Start)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (2)
63If node.Span.Start = diagnosticSpan.Start AndAlso node.Span.End < diagnosticSpan.End Then
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
58Dim symbol = model.GetEnclosingSymbol(node.Span.Start, cancellationToken)
Structure\Providers\DisabledTextTriviaStructureProvider.vb (1)
22Dim startPos = nodeSpan.Start
Structure\Providers\XmlExpressionStructureProvider.vb (2)
27Dim line = syntaxTree.GetText(cancellationToken).Lines.GetLineFromPosition(span.Start) 28Dim lineText = line.ToString().Substring(span.Start - line.Start)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (2)
EditAndContinue\BreakpointSpansTests.vb (2)
61source.Substring(expectedSpan.Value.Start, expectedSpan.Value.Length), 63source.Substring(breakpointSpan.Start, breakpointSpan.Length)))
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (36)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (34)
1258paramSymbol1.Locations.Single().SourceSpan.Start) 1266paramSymbol2.Locations.Single().SourceSpan.Start - "Optional ".Length) 1274paramSymbol3.Locations.Single().SourceSpan.Start) 1282paramSymbol4.Locations.Single().SourceSpan.Start) 1290paramSymbol5.Locations.Single().SourceSpan.Start) 1369Assert.Equal(syntax.SpanStart + 6, paramSymbol1.Locations.Single().SourceSpan.Start) 1374Assert.Equal(syntax.SpanStart + 6, paramSymbol2.Locations.Single().SourceSpan.Start) 1379Assert.Equal(syntax.SpanStart, paramSymbol3.Locations.Single().SourceSpan.Start) 1384Assert.Equal(syntax.SpanStart + 6, paramSymbol4.Locations.Single().SourceSpan.Start) 1849Assert.True(syntax.SpanStart = tpSymbol1.Locations.Item(0).SourceSpan.Start OrElse 1850syntax.SpanStart = tpSymbol1.Locations.Item(1).SourceSpan.Start, 1858Assert.True(syntax.SpanStart = tpSymbol2.Locations.Item(0).SourceSpan.Start OrElse 1859syntax.SpanStart = tpSymbol2.Locations.Item(1).SourceSpan.Start, 1867Assert.True(syntax.SpanStart = tpSymbol3.Locations.Item(0).SourceSpan.Start OrElse 1868syntax.SpanStart = tpSymbol3.Locations.Item(1).SourceSpan.Start, 1876Assert.True(syntax.SpanStart = tpSymbol4.Locations.Item(0).SourceSpan.Start OrElse 1877syntax.SpanStart = tpSymbol4.Locations.Item(1).SourceSpan.Start, 1885Assert.Equal(syntax.SpanStart, tpSymbol5.Locations.Single().SourceSpan.Start) 2022Assert.True(syntax.SpanStart = varSymbol1.Locations.Item(0).SourceSpan.Start OrElse 2023syntax.SpanStart = varSymbol1.Locations.Item(1).SourceSpan.Start, 2032Assert.True(syntax.SpanStart = varSymbol2.Locations.Item(0).SourceSpan.Start OrElse 2033syntax.SpanStart = varSymbol2.Locations.Item(1).SourceSpan.Start, 2042Assert.True(syntax.SpanStart = varSymbol3.Locations.Item(0).SourceSpan.Start OrElse 2043syntax.SpanStart = varSymbol3.Locations.Item(1).SourceSpan.Start, 2052Assert.True(syntax.SpanStart = varSymbol4.Locations.Item(0).SourceSpan.Start OrElse 2053syntax.SpanStart = varSymbol4.Locations.Item(1).SourceSpan.Start, 2062Assert.True(syntax.SpanStart = varSymbol5.Locations.Item(0).SourceSpan.Start OrElse 2063syntax.SpanStart = varSymbol5.Locations.Item(1).SourceSpan.Start, 2072Assert.True(syntax.SpanStart = varSymbol6.Locations.Item(0).SourceSpan.Start OrElse 2073syntax.SpanStart = varSymbol6.Locations.Item(1).SourceSpan.Start, 2083Assert.True(syntax.SpanStart = varSymbol7.Locations.Item(0).SourceSpan.Start OrElse 2084syntax.SpanStart = varSymbol7.Locations.Item(1).SourceSpan.Start, 2093Assert.True(syntax.SpanStart = varSymbol8.Locations.Item(0).SourceSpan.Start OrElse 2094syntax.SpanStart = varSymbol8.Locations.Item(1).SourceSpan.Start,
FlowAnalysis\FlowTestBase.vb (2)
173Dim startToken As SyntaxToken = tree.GetCompilationUnitRoot().FindToken(region.Start, True) 175While startToken.Span.End <= region.Start
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (40)
LocationTests.vb (2)
73Dim xToEndClassSpan As New TextSpan(xSpan.Start, sampleProgram.IndexOf("End Class", StringComparison.Ordinal) - xSpan.Start + 3)
TestSyntaxNodes.vb (38)
222Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start) 228Assert.Equal(list(i - 1).FullSpan.End, list(i).FullSpan.Start) 231Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start) 244Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start) 250Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start) 266Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start) 272Assert.Equal(list(i - 1).FullSpan.End, list(i).FullSpan.Start) 275Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start) 290Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start) 296Assert.Equal(list(i - 1).FullSpan.End, list(i).FullSpan.Start) 299Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start) 309Assert.Equal(expectedFullSpan.Start, list(0).FullSpan.Start) 315Assert.Equal(list(i).FullSpan.End, list(i + 1).FullSpan.Start) 334Assert.Equal(tree.SpanStart, tree.FullSpan.Start) 336VerifyListSpans(precedingTrivia, New TextSpan(tree.FullSpan.Start, (tree.SpanStart - tree.FullSpan.Start))) 359Assert.Equal(tree.SpanStart, tree.FullSpan.Start) 361VerifyListSpans(precedingTrivia, New TextSpan(tree.FullSpan.Start, (tree.SpanStart - tree.FullSpan.Start))) 411VerifyListSpans(statements, TextSpan.FromBounds(statements(0).FullSpan.Start, statements(statements.Count - 1).FullSpan.End)) 595Assert.Equal(start, seplist(0).FullSpan.Start) 685Assert.Equal(0, tok.FullSpan.Start) 701Assert.Equal(0, tok.FullSpan.Start) 709Assert.Equal(1, follTrivia(0).FullSpan.Start) 715Assert.Equal(4, follTrivia(1).FullSpan.Start) 728Assert.Equal(0, tok.FullSpan.Start) 740Assert.Equal(0, precTrivia(0).FullSpan.Start) 746Assert.Equal(4, precTrivia(1).FullSpan.Start) 752Assert.Equal(6, precTrivia(2).FullSpan.Start) 761Assert.Equal(10, follTrivia(0).FullSpan.Start) 934Dim i = span1.Start.CompareTo(span2.Start) 2298invalidSpan = New TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (8)
CompilationTestUtils.vb (5)
1009Dim lineText As String = GetLineText(sourceLocation.SourceTree.GetText(), sourceLocation.SourceSpan.Start, offsetInLine) 1056If loc1.SourceSpan.Start < loc2.SourceSpan.Start Then Return -1 1057If loc1.SourceSpan.Start > loc2.SourceSpan.Start Then Return 1
ParserTestUtilities.vb (1)
617If spanStart IsNot Nothing AndAlso CInt(spanStart) <> syntaxErrorSpan.Start Then
SemanticModelTestBase.vb (2)
90" Location1.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start & 91" Location2.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start
Microsoft.CodeAnalysis.VisualBasic.Workspaces (37)
Classification\ClassificationHelpers.vb (1)
324Dim tokens = SyntaxFactory.ParseTokens(text2, initialTokenPosition:=textSpan.Start)
Classification\Worker.DocumentationCommentClassifier.vb (3)
25If childFullSpan.Start > _worker._textSpan.End Then 27ElseIf childFullSpan.End < _worker._textSpan.Start Then 92spanStart = trivia.Span.Start + index
CodeCleanup\Providers\AbstractTokensCodeCleanupProvider.vb (1)
57_spans.GetIntervalsThatOverlapWith(node.FullSpan.Start, node.FullSpan.Length).Any()
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (2)
335_spans.HasIntervalThatContains(span.Start, span.Length) AndAlso 452If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (5)
93Not _spans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then 203If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then 243If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then 272If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then 455If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then
Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (1)
86Return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart)
Formatting\Rules\BaseFormattingRule.vb (1)
64Return TextSpan.FromBounds(spanStart, trivia.FullSpan.Start)
OrganizeImports\VisualBasicOrganizeImportsService.Rewriter.vb (2)
75Return TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.[End]) 79Return TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.[End])
Rename\VisualBasicRenameRewriterLanguageService.vb (4)
96newSpan = New TextSpan(oldSpan.Start, newSpan.Length) 236Me._renameSpansTracker.AddComplexifiedSpan(Me._documentId, oldSpan, New TextSpan(oldSpan.Start, newSpan.Length), Me._modifiedSubSpans) 294AddModifiedSpan(annotation.OriginalSpan, New TextSpan(token.Span.Start, newToken.Span.Length)) 303Dim symbols = RenameUtilities.GetSymbolsTouchingPosition(token.Span.Start, _semanticModel, _solution.Services, _cancellationToken)
Simplification\Simplifiers\AbstractVisualBasicSimplifier.vb (1)
172boundSymbols = semanticModel.LookupNamespacesAndTypes(node.Span.Start, name:=aliasName + "Attribute")
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (2)
141If interpolation.OpenBraceToken.Span.End = node.OpenParenToken.Span.Start AndAlso 142node.OpenParenToken.Span.End = expression.Span.Start Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
415If Not textSpan.Contains(matchSpan.Start) Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (2)
128If (child.FullSpan.Start < position) AndAlso (position <= child.FullSpan.End) Then 283If trivia.Span.Start > position Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (3)
833firstStatement.FullSpan.Start, 834method.EndBlockStatement.FullSpan.Start) 878Return outerSpan.Contains(innerSpan.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (3)
384Return Cast(Of TDeclarationNode)(AppendTriviaAtPosition(newMember, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode)) 394Return Cast(Of TDeclarationNode)(AppendTriviaAtPosition(newCompilationUnit, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode)) 403Return Cast(Of TDeclarationNode)(AppendTriviaAtPosition(newParameter, positionOfRemovedNode - destination.FullSpan.Start, triviaOfRemovedNode))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb (1)
550position = possibleTuple.FullSpan.Start
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (1)
72TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.Indenter.vb (3)
63Dim line = indenter.Text.Lines.GetLineFromPosition(trivia.FullSpan.Start) 64If line.GetFirstNonWhitespacePosition() = trivia.FullSpan.Start Then 65Return New IndentationResult(trivia.FullSpan.Start, 0)
Microsoft.CodeAnalysis.Workspaces (262)
Classification\Classifier.cs (1)
120return ConvertClassificationsToParts(sourceText, textSpan.Start, classifiedSpans);
Classification\ClassifierHelper.cs (9)
92var widenedSpan = new TextSpan(spans[0].Start, spans[^1].End); 141FillInClassifiedSpanGaps(widenedSpan.Start, mergedSpans, filledInSpans); 268syntacticPartSpan.Start, syntacticPartSpan.Length, ref tempBuffer.AsRef(), 292if (syntacticPartSpan.Start < firstSemanticPartSpan.Start) 295syntacticPartSpan.Start, 296firstSemanticPartSpan.Start))); 310if (semanticPart1Span.End < semanticPart2Span.Start) 314semanticPart2Span.Start)));
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (6)
135Contract.ThrowIfFalse(currentOld.FullSpan.Start == currentNew.FullSpan.Start); 144return currentOld.FullSpan.Start; 149return currentOld.FullSpan.Start; 202currentOld.FullSpan.Start >= commonLeftWidth && 203currentNew.FullSpan.Start >= commonLeftWidth)
CodeCleanup\AbstractCodeCleanerService.cs (2)
366startToken = root.FindToken(span.Start, findInsideTrivia: true); 385startToken = FindTokenOnLeftOfPosition(root, span.Start);
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (1)
120.ThenBy(d => d.Location.SourceSpan.Start)
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (4)
72var changesToApply = _totalChangesIntervalTree.Distinct().OrderBy(tc => tc.Span.Start); 105change.Span.Start, change.Span.Length, ref overlappingSpans); 108change.Span.Start, change.Span.Length, ref intersectingSpans); 190otherChange.Span.End == change.Span.Start;
Differencing\Edit.cs (1)
114=> (_comparer != null) ? "@" + _comparer.GetSpan(node).Start : "";
Editing\SymbolEditor.cs (1)
332return EditOneDeclarationAsync(symbol, doc.Id, location.SourceSpan.Start, editAction, cancellationToken);
FindSymbols\FindReferences\FindReferenceCache.cs (1)
202if (span.Start == index && span.Length == text.Length && isMatch(text, token, args))
FindSymbols\ReferenceLocationExtensions.cs (1)
73var enclosingSymbol = semanticModel.GetEnclosingSymbol(reference.Location.SourceSpan.Start);
FindSymbols\SyntaxTree\SyntaxTreeIndex_Persistence.cs (1)
50writer.WriteInt32(span.Start);
LanguageServices\FixAllSpanMappingService\AbstractFixAllSpanMappingService.cs (3)
55var partialDeclSpan = syntaxFacts.GetContainingTypeDeclaration(root, syntaxRef.Span.Start)?.FullSpan; 81? syntaxFacts.GetContainingMemberDeclaration(root, span.Start) 82: syntaxFacts.GetContainingTypeDeclaration(root, span.Start);
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (3)
43var changeStartLine = originalSourceText.Lines.GetLineFromPosition(change.Span.Start); 68var startPosition = changePartition.First().Span.Start; 75var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText!));
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (5)
151while (cumulativeChangeIndex < cumulativeChanges.Length && cumulativeChanges[cumulativeChangeIndex].Span.End < change.Span.Start) 274var orderedChanges = changes.Sort(static (c1, c2) => c1.Span.Start - c2.Span.Start); 280if (nextChange.Span.Start == currentChange.Span.End) 282currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
PatternMatching\AllLowerCamelCaseMatcher.cs (3)
96if (ToLower(candidate[candidateHump.Start], _textInfo) == patternCharacter) 162candidate, candidateHump.Start, 191var matchSpanToAdd = new TextSpan(candidateHump.Start, possibleHumpMatchLength);
PatternMatching\PatternMatcher.cs (8)
256var hump = TextSpan.FromBounds(candidateHumps[i].Start, candidateLength); 261matchedSpan: GetMatchedSpan(hump.Start, patternChunk.Text.Length)); 437candidate, candidatePart.Start, patternPart.Length, 438pattern, patternPart.Start, patternPart.Length, compareOptions) == 0; 575if (!char.IsUpper(patternChunk.Text[patternHumps[currentPatternHump - 1].Start]) || 576!char.IsUpper(patternChunk.Text[patternHumps[currentPatternHump].Start])) 587matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length)); 597candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
ReassignedVariable\AbstractReassignedVariableService.cs (1)
313if (current.SpanStart <= localOrParameterDeclarationSpan.Start)
Rename\ConflictEngine\ConflictResolver.cs (1)
411.ThenBy(l => l.IsInSource ? l.SourceSpan.Start : int.MaxValue);
Rename\ConflictEngine\ConflictResolver.Session.cs (8)
224renamedSpansTracker.GetAdjustedPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration), 550if (newLocations.Any(loc => loc.SourceSpan.Start == adjustedStartPosition)) 599if (newAdjustedStartPosition != newLocation.SourceSpan.Start) 607var overridingSymbol = await SymbolFinder.FindSymbolAtPositionAsync(solution.GetRequiredDocument(newLocation.SourceTree), newLocation.SourceSpan.Start, cancellationToken: _cancellationToken).ConfigureAwait(false); 658var newReferencedSymbols = RenameUtilities.GetSymbolsTouchingPosition(tokenOrNode.Span.Start, newDocumentSemanticModel, newDocument.Project.Solution.Services, _cancellationToken); 685? conflictResolution.GetAdjustedTokenStartingPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration) 686: _renameSymbolDeclarationLocation.SourceSpan.Start; 905var offset = renameLocation.Location.SourceSpan.Start - containingLocationForStringOrComment.Start;
Rename\ConflictEngine\RenamedSpansTracker.cs (1)
57? modifiedSpans.Where(pair => pair.oldSpan.Start < startingPosition)
Rename\RenameUtilities.cs (3)
264Debug.Assert(subSpan.Start <= replaceInsideString.Length); 268if (replaceInsideString.Substring(subSpan.Start, subSpan.Length) != matchText) 272var offset = subSpan.Start - startOffset;
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (2)
372.Select(t => Tuple.Create(t.ToString(), t.Span.Start, t.Span)); 390.Select(t => Tuple.Create(t.ToString(), t.Span.Start, t.Token.Span));
Shared\Extensions\SourceTextExtensions.cs (1)
57text.GetLineAndOffset(textSpan.Start, out startLineNumber, out startOffset);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
67index += span.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\Collections\ImmutableIntervalTree`1.cs (4)
59values.Sort((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start); 79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisStart = thisSpan.Start; 125var thisStart = thisSpan.Start; 138var thisStart = thisSpan.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.cs (1)
123if (introspector.GetSpan(witness.GetValue(tree, currentNode)).Start <= end)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
59var newNodeStart = introspector.GetSpan(newNode.Value).Start; 73if (newNodeStart < introspector.GetSpan(root.Value).Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (17)
96if (span1.Start < span2.Start) 286if ((span2.Length == 0) || (span1.Start >= span2.End)) 290else if (span1.End <= span2.Start) 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 302if (span1.Start < span2.Start) 306Debug.Assert(lastEnd < span2.Start); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 566if (end < span.Start) 576start = span.Start; 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 603var oldStart = sorted[0].Start; 607var newStart = sorted[i].Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (1)
28=> this.HasIntervalThatIntersectsWith(span.Start, span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (2)
47.ThenByDescending(x => x.section.Span.Start) 85.ThenByDescending(x => x.section.Span.Start) // in event of a further tie, pick entry at the bottom of the file
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (1)
19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (2)
85return span.Value.Start; 118start = Math.Min(token.VirtualChars[0].Span.Start, start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
82Math.Min(LeadingTrivia.Length == 0 ? int.MaxValue : LeadingTrivia[0].GetSpan().Start, 83Math.Min(VirtualChars.Length == 0 ? int.MaxValue : VirtualChars[0].Span.Start, 84TrailingTrivia.Length == 0 ? int.MaxValue : TrailingTrivia[0].GetSpan().Start));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
86Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 90Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 91currentVC.Span.Start == token.SpanStart + 2, "First span should start on the second or third char of the string."); 99Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 108Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching.");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
56if (span.Start > sequence.Length) 74public VirtualChar this[int index] => _leafCharacters[_span.Start + index]; 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length)); 197Debug.Assert(_span.End == virtualChars._span.Start); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (2)
20=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 39return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
48var startLineNumber = text.Lines.IndexOf(span.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
305Math.Min(fullSpan.Start, node.SpanStart), 672while (position <= token.SpanStart && root.FullSpan.Start < token.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
104var startLineNumber = text.Lines.IndexOf(span.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextLineExtensions.cs (1)
69for (var i = line.Span.Start; i < line.Span.End; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (8)
31if (span.Start < start) 33start = span.Start; 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 79var startSegmentEnd = Math.Min(span.End, except.Start); 80if (span.Start < startSegmentEnd) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 83var endSegmentStart = Math.Max(span.Start, except.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (2)
59if (token.Span.End <= operation.TextSpan.Start && 337if (operation.TextSpan.IsEmpty && operation.TextSpan.Start == position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (11)
162if (operationSpan.Start < baseSpan.Start || 208var inseparableRegionStartingPosition = effectiveBaseTokenGetter(this, operation).FullSpan.Start; 227var indentationData = _indentationTree.GetSmallestContainingInterval(operation.TextSpan.Start, 0); 413var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length); 450var indentationData = _relativeIndentationTree.GetSmallestContainingInterval(span.Start, 0); 472var anchorData = _anchorTree.GetSmallestContainingInterval(span.Start, 0); 476DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0)); 601var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length); 630var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length); 652=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (1)
109return new RelativeIndentationData(_formattingContext, InseparableRegionSpan.Start, span, Operation, _effectiveBaseTokenGetter, _indentationDeltaGetter, _baseIndentationGetter, _lazyIndentationDelta);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (7)
48var thisStart = thisSpan.Start; 60var thisStart = thisSpan.Start; 96if (Introspector.GetSpan(currentNode.Value).Start <= start) 132if (resultSpan.Start <= currentNodeSpan.Start && 164Introspector.GetSpan(parentNode.Value).Start == Introspector.GetSpan(currentNode.Value).Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (2)
83var oldText = (change.Span == span) ? originalString : originalString.Substring(change.Span.Start - span.Start, change.Span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
87Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
61get { return this.Root.FullSpan.Start; }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (1)
38return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.StructuredTrivia.cs (1)
43var text = _trivia.ToFullString()[..(token.SpanStart - _trivia.FullSpan.Start)];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
261span = new TextSpan(span.Start + i, span.Length - i); 324last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (9)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 152token1 = root.FindToken(span.Start); 157if (span.End < token1.Span.Start) 162if (token2.Span.End < span.Start) 177if (span.Start <= token1.Span.Start) 190var end = token2.Span.Start; 196end = token2.Span.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (1)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 39Contract.ThrowIfFalse(baseToken.Span.End <= textSpan.Start); 41Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (1)
22Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (5)
488if (ContainsOnlyWhitespace(firstToken.FullSpan.Start, firstToken.SpanStart)) 502for (var i = span.Start - this.Token1.Span.End; i < span.Length; i++) 836return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 844return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start); 938var offset = trivia.FullSpan.Start - this.StartPosition;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
249=> Math.Min(Root.EndOfFileToken.FullSpan.Start, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (1)
78words.Add(name.Substring(part.Start, part.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (8)
177=> name.Substring(wordSpan.Start, wordSpan.Length); 179private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 180private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 184for (int i = span.Start, n = span.End; i < n; i++) 197for (int i = span.Start, n = span.End; i < n; i++) 410newWords[i] = name[parts[i].Start..parts[i].End];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
27Current = new TextSpan(nameSpan.Start, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (3)
156(node.FullSpan.Start == 0 && _fileBannerMatcher.TryMatch(leadingTriviaToKeep, ref index))) 168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (3)
59if (holes.Any(static (h, position) => h.Span.Contains(position) && position > h.Span.Start, position)) 81if (tokenToRightOrIn.FullSpan.Start != position && tokenToRightOrIn.RawKind != SyntaxFacts.SyntaxKinds.EndOfFileToken) 97return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (3)
66? root.FindToken(textSpan.Start) 67: root.FindTokenOnRightOfPosition(textSpan.Start); 126var position = textSpan.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().Span.End); 459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
264WriteInteger(location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
29writer.WriteInt32(WordSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (13)
20return o1.TextSpan.Start - o2.TextSpan.Start; 26var d = o1.TextSpan.Start - o2.TextSpan.Start; 87var startToken = root.FindToken(textSpan.Start); 97if (textSpan.Start < startToken.SpanStart) 143return root.FullSpan.End == startToken.SpanStart || startToken.FullSpan.End > endToken.FullSpan.Start; 185if (token1.FullSpan.End == token2.FullSpan.Start) 193for (var token = token1.GetNextToken(includeZeroWidth: true); token.FullSpan.End <= token2.FullSpan.Start; token = token.GetNextToken(includeZeroWidth: true)) 304var forwardPosition = token.FullSpan.Start; 312Contract.ThrowIfFalse(parentNode.FullSpan.Start < forwardPosition); 328if (fullSpan.Start < position) 362var startToken = root.FindToken(span.Start).GetPreviousToken();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (1)
33Debug.Assert(span.Start >= start, "Bad generator.");
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (3)
506positionOfRemovedNode = attributeList.FullSpan.Start; 526positionOfRemovedNode = attributeToRemove.FullSpan.Start; 528var previousToken = root.FindToken(attributeToRemove.FullSpan.Start - 1);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (9)
78var location = selectionTrimmed.Start; 184else if (previousToken != default && previousToken.Span.End == commaToken.Span.Start) 198if (tokenToRight == default || tokenToRight.FullSpan.Start == location) 219if (tokenOnLocation.Span.Start >= location) 236var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 309var location = tokenToRightOrIn.Span.Start; 334if (rightNode.Span.Start != location) 337if (rightNodeSpanWithoutAttributes.Start != location) 538var argumentStartLine = sourceText.Lines.GetLineFromPosition(typedAncestor.Span.Start).LineNumber;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (7)
75if (node.FullSpan.Contains(selection.Start)) 77var selectionStartToken = node.FindToken(selection.Start); 84var beginningNode = node.FindToken(node.Span.Start).Parent; 96return beginningNode.Span.End <= selection.Start || endNode.Span.Start >= selection.End; 104/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 112var start = span.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
66bool OverlapsWithSpan(SyntaxNode n) => spansTree.HasIntervalThatOverlapsWith(n.FullSpan.Start, n.FullSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
138var token = root.FindToken(span.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
378if (p.Length > 0 && char.IsLetter(name[p.Start])) 379return name.Substring(p.Start, p.Length).ToCamelCase();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
147=> !spansTree.HasIntervalThatOverlapsWith(nodeOrToken.FullSpan.Start, nodeOrToken.FullSpan.Length);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Formatting\FormattingTestBase.cs (1)
111if (span.Start == 0 && span.End == inputText.Length)
Microsoft.CodeAnalysis.Workspaces.UnitTests (8)
BatchFixAllProviderTests.cs (1)
126var token = root.FindToken(sourceSpan.Start);
Shared\Extensions\TextSpanExtensions\SubtractTests.cs (7)
32private static int RightBeforeStart(TextSpan span) => span.Start - 1; 33private static int AtStart(TextSpan span) => span.Start; 34private static int RightAfterStart(TextSpan span) => span.Start + 1; 294EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), EmptySpan.Start))); 308EmptySpan.Subtract(TextSpan.FromBounds(EmptySpan.Start, EmptySpan.Start))); 315EmptySpan.Subtract(TextSpan.FromBounds(EmptySpan.Start, RightAfterEnd(EmptySpan))));
Microsoft.Gen.ComplianceReports.Unit.Tests (4)
test\Generators\Shared\RoslynTestUtils.cs (4)
418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.ContextualOptions.Unit.Tests (4)
test\Generators\Shared\RoslynTestUtils.cs (4)
418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.Logging.Unit.Tests (4)
test\Generators\Shared\RoslynTestUtils.cs (4)
418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.Metrics.Unit.Tests (4)
test\Generators\Shared\RoslynTestUtils.cs (4)
418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.MetricsReports.Unit.Tests (4)
test\Generators\Shared\RoslynTestUtils.cs (4)
418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\CustomMarshallerAttributeFixer.cs (1)
39var entryPointTypeSymbol = (INamedTypeSymbol)model.GetEnclosingSymbol(diagnostic.Location.SourceSpan.Start, fixAllContext.CancellationToken);
Microsoft.Maui.Controls.BindingSourceGen (1)
BindingSourceGenerator.cs (1)
130 NullableContext nullableContext = context.SemanticModel.GetNullableContext(context.Node.Span.Start);
Microsoft.ML.InternalCodeAnalyzer (2)
ContractsCheckNameofFixProvider.cs (1)
44var nameArg = root.FindToken(diagnosticSpan.Start).Parent.FirstAncestorOrSelf<ArgumentSyntax>();
NameFixProvider.cs (1)
60var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
Microsoft.VisualStudio.LanguageServices (46)
FindReferences\Contexts\AbstractTableDataSourceFindUsagesContext.cs (1)
502return (excerptResult, AbstractDocumentSpanEntry.GetLineContainingPosition(sourceText, sourceSpan.Start));
FindReferences\Entries\DocumentSpanEntry.cs (1)
235var lineNumber = sourceText.Lines.GetLineFromPosition(referenceSpan.Start).LineNumber;
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (1)
97start = prevToken.Span.Start;
Snippets\AbstractSnippetCommandHandler.cs (2)
276if (!IsSnippetExpansionContext(document, span.Value.Start, cancellationToken)) 281return GetSnippetExpansionClientFactory(document).GetOrCreateSnippetExpansionClient(document, textView, subjectBuffer).TryInsertExpansion(span.Value.Start, span.Value.End, cancellationToken);
ValueTracking\TreeItemViewModel.cs (4)
77sourceText.GetLineAndOffset(textSpan.Start, out var lineStart, out var _); 115var spanStartPosition = TextSpan.Start - ClassifiedSpans[0].TextSpan.Start; 129if (position == highlightSpan.Start || highlightSpan.Contains(position))
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)
Venus\ContainedDocument.DocumentServiceProvider.cs (3)
215if (spanOnContentSpan.Start < startPositionOnContentSpan) 318=> new(targetSpan.Start - excerptSpan.Start, targetSpan.Length);
Venus\ContainedLanguage.IVsContainedCode.cs (1)
59iStartLine = snapshot.GetLineNumberFromPosition(tuple.Item1.Start),
Venus\ContainedLanguageCodeSupport.cs (3)
210var position = type.Locations.First(loc => loc.SourceTree == targetSyntaxTree).SourceSpan.Start; 300? semanticModel.LookupSymbols(position: type.Locations[0].SourceSpan.Start, container: type, name: null) 497return semanticModel.LookupSymbols(typeLocation.SourceSpan.Start, objectType, nameOfEvent).SingleOrDefault(m => m.Kind == SymbolKind.Event);
Workspace\VisualStudioDocumentNavigationService.cs (1)
377=> TextSpan.FromBounds(GetPositionWithinDocumentBounds(span.Start, documentLength), GetPositionWithinDocumentBounds(span.End, documentLength));
Microsoft.VisualStudio.LanguageServices.CSharp (7)
CodeModel\CSharpCodeModelService.cs (2)
2874deletionStart = trivia.FullSpan.Start; 3198var startToken = root.FindToken(span.Start).GetPreviousToken();
LanguageService\CSharpHelpContextService.cs (4)
46var token = await syntaxTree.GetTouchingTokenAsync(span.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false); 64var trivia = root.FindTrivia(span.Start, findInsideTrivia: true); 75var start = span.Start; 76var end = span.Start;
SemanticSearch\SemanticSearchToolWindowImpl.cs (1)
469var snapshotSpan = new SnapshotSpan(textSnapshot, textSpan.Start, textSpan.Length);
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
514edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Microsoft.VisualStudio.LanguageServices.UnitTests (9)
Debugging\VisualBasicBreakpointResolutionServiceTests.vb (1)
33source.Substring(expectedSpan.Value.Start, expectedSpan.Value.Length),
Snippets\SnippetExpansionClientTestsHelper.vb (5)
20Dim snippetStartLine = surfaceBufferDocument.GetTextBuffer().CurrentSnapshot.GetLineFromPosition(snippetSpanInSurfaceBuffer.Start) 21Dim snippetEndLine = surfaceBufferDocument.GetTextBuffer().CurrentSnapshot.GetLineFromPosition(snippetSpanInSurfaceBuffer.Start) 25.iStartIndex = snippetSpanInSurfaceBuffer.Start - snippetStartLine.Start.Position, 71Dim snippetStartLine = document.GetTextBuffer().CurrentSnapshot.GetLineFromPosition(snippetSpan.Start) 76.iStartIndex = snippetSpan.Start - snippetStartLine.Start.Position,
Venus\DocumentService_IntegrationTests.vb (2)
327Dim line = mappedSource.Lines.GetLineFromPosition(mappedSpan.Start) 328Return New ExcerptResult(mappedSource.GetSubText(line.Span), New TextSpan(mappedSpan.Start - line.Start, mappedSpan.Length), ImmutableArray.Create(New ClassifiedSpan(New TextSpan(0, line.Span.Length), ClassificationTypeNames.Text)), document, span)
Venus\DocumentServiceTests.vb (1)
255Assert.Equal(New TextSpan(documentSpan.Start - contentSpan.Start, documentSpan.Length), result.Value.MappedSpan)
Microsoft.VisualStudio.LanguageServices.VisualBasic (4)
CodeModel\VisualBasicCodeModelService.vb (2)
1298deletionStart = trivia.FullSpan.Start 3732Dim startToken = GetTokenWithoutAnnotation(root.FindToken(span.Start).GetPreviousToken(), Function(t) t.GetPreviousToken())
Help\VisualBasicHelpContextService.vb (2)
41Dim token = tree.GetRoot(cancellationToken).FindToken(span.Start, findInsideTrivia:=True) 53Dim trivia = tree.GetRoot(cancellationToken).FindTrivia(span.Start, findInsideTrivia:=True)
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Features\DocumentSpan.cs (1)
26return $"{Document.Name} [{TextSpan.Start}...{TextSpan.End}]";
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
140nodeToFix = root.FindNode(new TextSpan(nodeToFix.Span.Start + (typesModified * "partial".Length), nodeToFix.Span.Length), getInnermostNodeForTie: true);
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (1)
42PropertyDeclarationSyntax? propertyDeclaration = root.FindToken(diagnosticSpan.Start)
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (1)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (1)
49FindToken(diagnosticSpan.Start).