1 write to Length
Microsoft.CodeAnalysis (1)
Text\TextSpan.cs (1)
35Length = length;
542 references to Length
Microsoft.Analyzers.Local.Tests (1)
InternalReferencedInPublicDocAnalyzerTests.cs (1)
471var text = source.Substring(location.SourceSpan.Start, location.SourceSpan.Length);
Microsoft.AspNetCore.App.Analyzers (11)
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (1)
176index += result[result.Count - 1].Span.Length;
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (3)
225lineStart = lineSpan.Length > indentationLength 281index += charResults.Last().span.Length; 291index += charResults.Last().span.Length;
Infrastructure\VirtualChars\VirtualCharSequence.cs (2)
73public int Length => _span.Length; 91=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
260properties.Add(LengthKey, textChange.Span.Length.ToString(CultureInfo.InvariantCulture));
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (2)
104if (token.Span.Length == 0) 138if (token.Span.Length > 0 && token.SpanStart <= position)
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
139properties.Add(LengthKey, textChange.Span.Length.ToString(CultureInfo.InvariantCulture));
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
294var fullSyntaxLength = location.SourceSpan.Length;
Microsoft.AspNetCore.App.Analyzers.Test (1)
RouteEmbeddedLanguage\RoutePatternClassifierTests.cs (1)
33var actualFormatted = actualOrdered.Select(a => new FormattedClassification(rewrittenCode.Substring(a.TextSpan.Start, a.TextSpan.Length), a.ClassificationType)).ToArray();
Microsoft.CodeAnalysis (65)
Diagnostic\SourceLocation.cs (1)
130return base.GetDebuggerDisplay() + "\"" + _syntaxTree.ToString().Substring(_span.Start, _span.Length) + "\"";
DiagnosticAnalyzer\AnalysisScope.cs (1)
170if (filterSpan.GetValueOrDefault().Start == 0 && filterSpan.GetValueOrDefault().Length == filterFile.GetValueOrDefault().SourceTree!.Length)
Syntax\SyntaxDiffer.cs (21)
115delta += change.Range.NewLength - change.Range.Span.Length; 310if (sim >= Math.Max(_oldNodes.Peek().FullSpan.Length, _newNodes.Peek().FullSpan.Length)) 328if (child.FullSpan.Length > 0) 358var sim = node.FullSpan.Length; 372if (sim == node.FullSpan.Length && node.IsToken) 404similarity = node.FullSpan.Length; 459w += tr.FullSpan.Length; 468w += tr.FullSpan.Length; 490w += n2.FullSpan.Length; 549RecordChange(new TextChangeRange(oldSpan, newSpan.Length), removedNode, insertedNode); 559RecordChange(new ChangeRecord(new TextChangeRange(oldSpan, newSpan.Length), removedNodes, insertedNodes)); 569RecordChange(new ChangeRecord(new TextChangeRange(new TextSpan(start, 0), newSpan.Length), null, insertedNodes)); 581new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + change.Range.Span.Length), last.Range.NewLength + change.Range.NewLength), 604new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + textChangeRange.Span.Length), last.Range.NewLength + textChangeRange.NewLength), 748if (cr.Range.Span.Length > 0 && cr.Range.NewLength > 0) 763new TextSpan(range.Span.Start + commonLeadingCount, range.Span.Length - (commonLeadingCount + commonTrailingCount)), 778if (range.Span.Length > 0 || range.NewLength > 0) 827var builder = new StringBuilder(span.Length);
Syntax\SyntaxNode.Iterators.cs (1)
42|| (childSpan.Length == 0 && span.IntersectsWith(childSpan));
Text\ChangedText.cs (1)
38deltaLength += change.NewLength - change.Span.Length;
Text\CompositeText.cs (4)
88var count = span.Length; 504var lineLength = firstSegmentTextLine.SpanIncludingLineBreak.Length; 517lineLength += nextSegment.Lines[0].SpanIncludingLineBreak.Length; 527lineLength += lastSegment.Lines[0].SpanIncludingLineBreak.Length;
Text\LargeText.cs (1)
189int count = span.Length;
Text\SourceText.cs (3)
503int spanLength = span.Length; 792if (change.Span.Length == 0 && newTextLength == 0) 924newPosDelta += range.NewLength - range.Span.Length;
Text\StringBuilderText.cs (1)
85return _builder.ToString(span.Start, span.Length);
Text\StringText.cs (2)
78if (span.Start == 0 && span.Length == this.Length) 83return this.Source.Substring(span.Start, span.Length);
Text\SubText.cs (5)
43public override int Length => UnderlyingSpan.Length; 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); 205if (position < 0 || position > _subText.UnderlyingSpan.Length)
Text\TextChange.cs (1)
107return $"new TextChange(new TextSpan({Span.Start}, {Span.Length}), {newTextDisplay})";
Text\TextChangeRange.cs (3)
107diff += change.NewLength - change.Span.Length; 127var newLen = combined.Length + diff; 134return $"new TextChangeRange(new TextSpan({Span.Start}, {Span.Length}), {NewLength})";
Text\TextChangeRangeExtensions.cs (10)
86currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 150if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 308oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 310var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 373oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 430: this(range.Span.Start, range.Span.Length, range.NewLength)
Text\TextLine.cs (1)
67span = new TextSpan(span.Start, span.Length + lineBreakLen);
Text\TextSpan.cs (9)
47public int End => Start + Length; 58public bool IsEmpty => this.Length == 0; 72return unchecked((uint)(position - Start) < (uint)Length); 156return unchecked((uint)(position - Start) <= (uint)Length); 221return Start == other.Start && Length == other.Length; 235return Hash.Combine(Start, Length); 259return Length - other.Length;
Microsoft.CodeAnalysis.CodeStyle (53)
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
69var offset = change.Span.Length - change.NewText.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (10)
86currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 150if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 308oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 310var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 373oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 430: this(range.Span.Start, range.Span.Length, range.NewLength)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (1)
286if ((span2.Length == 0) || (span1.Start >= span2.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (1)
28=> this.HasIntervalThatIntersectsWith(span.Start, span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (1)
178index += result[^1].Span.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
69public int Length => _span.Length; 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (8)
196=> node.Span.Length; 199=> node.FullSpan.Length; 424d = x.Length - y.Length; 555if (token.Span.Length > 0 && position <= token.Span.End) 585if (token.Span.Length > 0 && token.SpanStart <= position) 641if (token.Span.Length == 0) 680if (token.Span.Length == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (2)
64=> token.Span.Length; 67=> token.FullSpan.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTriviaExtensions.cs (2)
10=> trivia.Span.Length; 13=> trivia.FullSpan.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (4)
413var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length); 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\ContextMutableIntervalTree.cs (2)
133currentNodeSpan.Length < resultSpan.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (1)
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)
61var sizeOfList = spanToFormat.Length / MagicTextLengthToTokensRatio;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (3)
244for (; i < span.Length; i++) 253if (i == span.Length && text.Length == newText.Length) 261span = new TextSpan(span.Start + i, span.Length - i);
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 (2)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 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 (1)
502for (var i = span.Start - this.Token1.Span.End; i < span.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
160Debug.Assert(spanToCheck.Length > 0); 177=> name.Substring(wordSpan.Start, wordSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (3)
23Debug.Assert(nameSpan.Length > 0); 37if (Current.Length == 0) 76return Current.Length > 0 && Current.End <= _nameSpan.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
74var sb = new StringBuilder(summaryElement.Span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
259WriteInteger(location.SourceSpan.Length);
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)
30writer.WriteInt32(WordSpan.Length);
Microsoft.CodeAnalysis.CodeStyle.Fixes (5)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (3)
149if (condition.Span.Length + trueSyntax.Span.Length + falseSyntax.Span.Length > formattingOptions.ConditionalExpressionWrappingLength)
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\Simplification\AbstractSimplificationService.cs (1)
169=> !spansTree.HasIntervalThatOverlapsWith(nodeOrToken.FullSpan.Start, nodeOrToken.FullSpan.Length);
Microsoft.CodeAnalysis.CSharp (12)
Compiler\UnprocessedDocumentationCommentFinder.cs (1)
56if (node.Span.Length > 0)
FlowAnalysis\AbstractFlowPass.cs (2)
300Debug.Assert(span.Length > 0); 301if (span.Length == 0)
FlowAnalysis\ControlFlowPass.cs (1)
266statement.Syntax.Span.Length != 0)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
631return new TextSpan(startSpan.Start, originalSpan.Length - (startSpan.Start - originalSpan.Start));
Parser\Blender.Reader.cs (1)
134_changeDelta += change.NewLength - change.Span.Length;
Symbols\Source\SourceConstructorSymbolBase.cs (1)
198ctorInitializerLength = span.Length;
Symbols\Source\SourceMemberContainerSymbol.cs (2)
1107aggregateLength += syntaxRef.Span.Length; 1237return initializer.Syntax.Span.Length;
Symbols\Symbol.cs (1)
511if (location.SourceSpan.Length != 0)
Syntax\CSharpSyntaxTree.ParsedSyntaxTree.cs (1)
85get { return _root.FullSpan.Length; }
Syntax\SyntaxTreeDiagnosticEnumerator.cs (1)
62var length = _syntaxTree.GetRoot().FullSpan.Length;
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (1)
52if (_ignoredSpans.HasIntervalThatContains(node.SpanStart, node.Span.Length))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
214lineStart = lineSpan.Length > indentationLength
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (4)
366return token.Span.Length == startDelimeterLength || 367(token.Span.Length > startDelimeterLength && endDelimeterLength < startDelimeterLength); 372return token.Span.Length == startDelimeterLength || 373(token.Span.Length > startDelimeterLength && token.Text[^1] != lastChar);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
132var initialColumn = (token1.RawKind == 0) ? 0 : this.TreeInfo.GetOriginalColumn(Options.TabSize, token1) + token1.Span.Length;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
182while (commonIndentation < indentation.Length && commonIndentation < textLine.Span.Length)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
766totalLength += component.Span.Length;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (5)
BlockCommentEditing\BlockCommentEditingCommandHandler.cs (1)
303if (span.Length < "/**/".Length)
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (1)
125startToken = selectionSpan.Length == 0
StringCopyPaste\StringCopyPasteHelpers.cs (3)
530for (var n = Math.Min(commonIndentPrefix.Length, lineWhitespaceSpan.Length); commonPrefixLength < n; commonPrefixLength++) 551if (spans.First().Length > 0 && text[spans.First().Start] == '"') 554if (spans.Last().Length > 0 && text[spans.Last().End - 1] == '"')
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
ExtractMethod\MiscTests.cs (1)
134view.TextBuffer.CurrentSnapshot, testDocument.SelectedSpans[0].Start, testDocument.SelectedSpans[0].Length), isReversed: false);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
FlowAnalysis\RegionAnalysisTests.cs (1)
7910Assert.Equal(0, stmt.Span.Length);
Microsoft.CodeAnalysis.CSharp.Features (23)
BraceCompletion\StringLiteralBraceCompletionService.cs (1)
74token.Span.Length > 1 &&
Debugging\CSharpBreakpointResolutionService.cs (1)
41if (span.Length == 0)
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 (1)
93if (breakpointSpan.Value.Length >= minLength)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (6)
601=> BreakpointSpans.TryGetClosestBreakpointSpan(token.Parent!, token.SpanStart, minLength: token.Span.Length, out span); 1827(commonForEachStatement.AwaitKeyword.Span.Length > 0) ? commonForEachStatement.AwaitKeyword.SpanStart : commonForEachStatement.ForEachKeyword.SpanStart, 1943=> (first.Length > 0 && second.Length > 0) ? TextSpan.FromBounds(first.Start, second.End) : (first.Length > 0) ? first : (second.Length > 0) ? second : defaultSpan;
InlineHints\CSharpInlineTypeHintsService.cs (1)
131var trailingSpace = span.Length == 0;
SplitOrMergeIfStatements\CSharpMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
36if (span.Length == 0 || 51if (span.Length == 0 ||
SplitOrMergeIfStatements\CSharpMergeNestedIfStatementsCodeRefactoringProvider.cs (2)
36if (span.Length == 0 || 51if (span.Length == 0 ||
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (1)
52if (_ignoredSpans.HasIntervalThatContains(node.SpanStart, node.Span.Length))
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
182while (commonIndentation < indentation.Length && commonIndentation < textLine.Span.Length)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
766totalLength += component.Span.Length;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (7)
EditAndContinue\BreakpointSpansTests.cs (4)
47Assert.True(breakpointSpan.Length == 0); 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) + "|]");
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
54var expectedText = source.Substring(expected.Start, expected.Length); 63var actualText = source.Substring(actual.Start, actual.Length);
EditAndContinue\SyntaxUtilitiesTests.cs (1)
24foreach (var oldNode in oldRoot.DescendantNodes().Where(n => n.FullSpan.Length > 0))
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (51)
Diagnostics\LocationsTests.cs (4)
562Assert.Equal(5, treeSpan.Length); 568Assert.Equal(0, diagnostics[0].Location.SourceSpan.Length); 590Assert.Equal(0, treeSpan.Length); 596Assert.Equal(0, diagnostics[0].Location.SourceSpan.Length);
LexicalAndXml\LexicalTests.cs (26)
3879Assert.True(trivia.Span.Length == 8); 3958Assert.Equal(22, trivia.Span.Length); 3971Assert.Equal(16, trivia.Span.Length); 3981Assert.Equal(2, trivia.Span.Length); 3986Assert.Equal(13, trivia.Span.Length); 3995Assert.Equal(16, trivia.Span.Length); 4004Assert.Equal(2, trivia.Span.Length); 4008Assert.Equal(34, trivia.Span.Length); 4016Assert.Equal(16, trivia1.Span.Length); 4026Assert.Equal(2, trivia2.Span.Length); 4031Assert.Equal(15, trivia3.Span.Length); 4036Assert.Equal(24, trivia4.Span.Length); 4049Assert.Equal(16, trivia1.Span.Length); 4059Assert.Equal(2, trivia2.Span.Length); 4064Assert.Equal(24, trivia3.Span.Length); 4097Assert.Equal(22, trivia.Span.Length); 4105Assert.Equal(16, trivia.Span.Length); 4110Assert.Equal(2, trivia.Span.Length); 4115Assert.Equal(13, trivia.Span.Length); 4124Assert.Equal(16, trivia.Span.Length); 4128Assert.Equal(2, trivia.Span.Length); 4132Assert.Equal(34, trivia.Span.Length); 4140Assert.Equal(16, trivia1.Span.Length); 4145Assert.Equal(2, trivia2.Span.Length); 4150Assert.Equal(15, trivia3.Span.Length); 4155Assert.Equal(24, trivia4.Span.Length);
Parsing\ScriptParsingTests.cs (1)
9739Assert.Equal(0, endOfDirective.Span.Length);
Syntax\SyntaxNodeTests.cs (20)
1757Assert.Equal(rootNode.FullSpan.Length, rootNode.ToFullString().Length); 1758Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 1775Assert.Equal(rootNode.FullSpan.Length, rootNode.ToFullString().Length); 1776Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 3693Assert.Equal(0, idToken.LeadingTrivia.Span.Length); // zero-width elastic trivia 3696Assert.Equal(0, idToken.TrailingTrivia.Span.Length); // zero-width elastic trivia 3709Assert.Equal(1, idToken.LeadingTrivia.Span.Length); 3712Assert.Equal(2, idToken.TrailingTrivia.Span.Length); 3718Assert.Equal(0, namedNode.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3721Assert.Equal(0, namedNode.GetTrailingTrivia().Span.Length); // zero-width elastic trivia 3734Assert.Equal(1, namedNode.GetLeadingTrivia().Span.Length); 3737Assert.Equal(2, namedNode.GetTrailingTrivia().Span.Length); 3743Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3746Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia 3752Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3755Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia 3775Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3778Assert.Equal(2, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia 3784Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3787Assert.Equal(2, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia
Microsoft.CodeAnalysis.CSharp.Workspaces (12)
Classification\ClassificationHelpers.cs (2)
531if (token.Span.Length == span.Length)
Classification\Worker.cs (1)
61=> span.Length > 0 && _textSpan.OverlapsWith(span);
Rename\CSharpRenameRewriterLanguageService.cs (2)
111newSpan = new TextSpan(oldSpan.Start, newSpan.Length); 317_renameSpansTracker.AddComplexifiedSpan(_documentId, oldSpan, new TextSpan(oldSpan.Start, newSpan.Length), _modifiedSubSpans);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
214lineStart = lineSpan.Length > indentationLength
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (4)
366return token.Span.Length == startDelimeterLength || 367(token.Span.Length > startDelimeterLength && endDelimeterLength < startDelimeterLength); 372return token.Span.Length == startDelimeterLength || 373(token.Span.Length > startDelimeterLength && token.Text[^1] != lastChar);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
132var initialColumn = (token1.RawKind == 0) ? 0 : this.TreeInfo.GetOriginalColumn(Options.TabSize, token1) + token1.Span.Length;
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.ParsedSyntaxTree.cs (1)
62=> _root.FullSpan.Length;
Microsoft.CodeAnalysis.EditorFeatures (7)
Editor\TextEditApplication.cs (1)
42edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Formatting\FormatCommandHandler.cs (1)
60using (Logger.LogBlock(FunctionId.CommandHandler_FormatCommand, KeyValueLogMessage.Create(LogType.UserAction, m => m["Span"] = selectionOpt?.Length ?? -1), cancellationToken))
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));
TextStructureNavigation\AbstractTextStructureNavigatorProvider.TextStructureNavigator.cs (3)
104if (token.Span.Length == 0 && token.Span.Start == textLength) 109if (token.Span.Length > 0 && token.Span.Contains(position) && !_provider.IsWithinNaturalLanguage(token, position)) 143if (node != null && activeSpan.Length == node.Value.Span.Length)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (9)
Classification\ClassificationTestHelper.cs (1)
54var text = actualText.Substring(actual.TextSpan.Start, actual.TextSpan.Length);
CompleteStatement\AbstractCompleteStatementTests.cs (1)
114view.Selection.Select(new SnapshotSpan(view.TextSnapshot, selectedSpan.Start, selectedSpan.Length), isReversed);
DocumentationComments\AbstractDocumentationCommentTests.cs (1)
153view.Selection.Select(new SnapshotSpan(view.TextSnapshot, selectedSpan.Start, selectedSpan.Length), isReversed);
KeywordHighlighting\AbstractKeywordHighlighterTests.cs (1)
58for (var i = 0; i <= cursorSpan.Length; i++)
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 (3)
369var span = new Span(matchingSpan.Start, matchingSpan.Length); 389currentPositionInProjectionBuffer += matchingSpan.Length; 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 (7)
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 (2)
492var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length)); 509var placeholderText = text.Substring(spans[0].Start, spans[0].Length);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (2)
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);
Microsoft.CodeAnalysis.Features (32)
ClassifiedSpansAndHighlightSpanFactory.cs (1)
61length: narrowSpan.Length);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (3)
154var delta = textChange.NewText.Length - textChange.Span.Length; 161currentSpan = new TextSpan(newStart, currentSpan.Length); 167var newLength = currentSpan.Length + delta;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (3)
45var spanChange = newStartToken.LeadingTrivia.FullSpan.Length - startToken.LeadingTrivia.FullSpan.Length; 46diagnosticSpan = new TextSpan(diagnosticSpan.Start + spanChange, diagnosticSpan.Length);
CodeLens\CodeLensReferencesService.cs (3)
143var referenceSpan = new TextSpan(spanStart, token.Span.Length); 155token.Span.Length, 163referenceSpan.Length,
Completion\Utilities.cs (2)
39var sumOfDeltas = changes.Sum(c => c.NewText!.Length - c.Span.Length); 40var totalNewSpan = new TextSpan(totalOldSpan.Start, totalOldSpan.Length + sumOfDeltas);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (3)
174=> oldToken.RawKind == newToken.RawKind && oldToken.Span.Length == newToken.Span.Length && AreEquivalentImpl(oldToken, newToken); 1642if (TryGetActiveSpan(statement, statementPart, minLength: statement.Span.Length, out var span))
QuickInfo\IndentationHelper.cs (2)
62if (spanBeforeDeletion.Length > 0) 74if (span.Length > 0)
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
162if (span.Length != 0)
Snippets\RoslynLSPSnippetConverter.cs (1)
47for (var i = 0; i < textChange.Span.Length + 1;)
SolutionCrawler\AbstractDocumentDifferenceService.cs (3)
175var lengthDelta = range.NewLength - range.Span.Length; 177return (oldMember.Span.Length + lengthDelta) == newMember.Span.Length ? newMember : null;
SpellCheck\AbstractSpellCheckSpanService.cs (1)
60if (span.TextSpan.Length > 0)
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
69var offset = change.Span.Length - change.NewText.Length;
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (3)
149if (condition.Span.Length + trueSyntax.Span.Length + falseSyntax.Span.Length > formattingOptions.ConditionalExpressionWrappingLength)
TaskList\AbstractTaskListService.cs (1)
139var message = postfixLength == 0 ? fullString : fullString[..(fullSpan.Length - postfixLength)];
Wrapping\ChainedExpression\ChainedExpressionCodeActionComputer.cs (1)
142var position = _firstPeriodIndentationTrivia.FullSpan.Length + NormalizedWidth(firstChunk);
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (3)
315currentOffset += item.Span.Length; 332currentOffset = indentationTrivia.FullWidth() + item.Span.Length; 342currentOffset += comma.Span.Length;
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\EditAndContinueTestVerifier.cs (1)
515.ThenByDescending(partners => partners.Key.Span.Length)
Microsoft.CodeAnalysis.LanguageServer.Protocol (9)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (1)
434Debug.Assert(span.Value.Length < _text.Length);
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (1)
675if (selectionOpt?.Length > 0)
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (1)
43if (span.Length > 0)
Handler\InlineCompletions\InlineCompletionsHandler.cs (4)
209var fieldInSnippetContext = GetTextSpanInContextOfSnippet(fieldInFormattedText.Start, spanContainingFormattedSnippet.Start, fieldInFormattedText.Length); 218var caretInSnippetContext = GetTextSpanInContextOfSnippet(caretInFormattedText.Start, spanContainingFormattedSnippet.Start, caretInFormattedText.Length); 230var amountToAdjust = textChangesBefore.Sum(t => t.NewText!.Length - t.Span.Length); 231return new TextSpan(originalSpan.Start + amountToAdjust, originalSpan.Length);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
214var amountToIndent = desiredCaretLinePosition.Character - lineToIndent.Span.Length;
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
213if (textSpan.Length > 0)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (2)
SemanticTokens\AbstractSemanticTokensTests.cs (1)
99var lineLength = text.Lines[currentLine].SpanIncludingLineBreak.Length;
SpellCheck\SpellCheckTests.cs (1)
577ranges[index++] = span.Length;
Microsoft.CodeAnalysis.UnitTests (24)
Text\LargeTextTests.cs (2)
163Assert.Equal(length, textLine.Span.Length); 165Assert.Equal(length + newlineLength, textLine.SpanIncludingLineBreak.Length);
Text\SourceTextTests.cs (2)
48Assert.Equal(0, text.Lines[0].Span.Length); 449Assert.Equal(Text.Substring(span.Start, span.Length), writer.ToString());
Text\StringText_LineTest.cs (3)
86Assert.Equal(0, line.Span.Length); 87Assert.Equal(0, line.SpanIncludingLineBreak.Length); 100Assert.Equal(Environment.NewLine.Length, line.SpanIncludingLineBreak.Length);
Text\StringTextDecodingTests.cs (2)
246Assert.Equal(3, text.Lines[0].Span.Length); 276Assert.Equal(3, text.Lines[0].Span.Length);
Text\StringTextTest.cs (4)
48Assert.Equal(3, data.Lines[0].Span.Length); 63Assert.Equal(0, data.Lines[0].Span.Length); 116Assert.Equal(length, textLine.Span.Length); 118Assert.Equal(length + newlineLength, textLine.SpanIncludingLineBreak.Length);
Text\StringTextTests_Default.cs (2)
43Assert.Equal(0, data.Lines[0].Span.Length); 60Assert.Equal(3, data.Lines[0].Span.Length);
Text\TextChangeTests.cs (2)
79Assert.Equal(0, changes[0].Span.Length); 982editedLength = editedLength - newChange.Span.Length + newChange.NewText.Length;
Text\TextSpanTest.cs (7)
23Assert.Equal(42, span.Length); 32Assert.Equal(40, span.Length); 44Assert.Equal(0, span.Length); 92Assert.Equal(0, span.Length); 103Assert.Equal(1, span.Length); 115Assert.Equal(1485, span.Length); 125Assert.Equal(int.MaxValue - 1, span.Length);
Microsoft.CodeAnalysis.VisualBasic (13)
Analysis\FlowAnalysis\AbstractFlowPass.Regions.vb (1)
55If span.Length = 0 Then
GlobalImport.vb (1)
119Dim length = unmappedSpan.Length
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (1)
550Return New Text.TextSpan(startSpan.Start, originalSpan.Length - (startSpan.Start - originalSpan.Start))
Scanner\Blender.vb (6)
96If span.Length = 0 Then 222_affectedRange = New TextChangeRange(span, span.Length - _change.Span.Length + _change.NewLength) 231Return position - _change.NewLength + _change.Span.Length 438Debug.Assert(_curNodeSpan.Length > 0) 439If _affectedRange.Span.Length = 0 Then
Scanner\Directives.vb (1)
546lengthSkipped += skippedSpan.Length
Scanner\Scanner.vb (1)
349Return SyntaxFactory.DisabledTextTrivia(GetTextNotInterned(span.Start, span.Length))
Symbols\Source\SourceMemberContainerTypeSymbol.vb (1)
3231aggregateLength += syntaxRef.Span.Length
Syntax\VisualBasicSyntaxTree.ParsedSyntaxTree.vb (1)
97Return _root.FullSpan.Length
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (2)
233(token.Span.Length = startLength OrElse 234(token.Span.Length > startLength AndAlso Not token.ToString().EndsWith(lastChar, StringComparison.Ordinal)))
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (1)
79Dim leading = SyntaxFactory.ParseLeadingTrivia(text.Substring(trailing.FullSpan.Length))
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (2)
LineCommit\CommitCommandHandler.vb (1)
109Dim selectedSpan = New SnapshotSpan(snapshot, textspan.Start, textspan.Length)
Utilities\NavigationPointHelpers.vb (1)
63Dim totalLineSize = line.GetColumnFromLineOffset(line.Span.Length, indentSize)
Microsoft.CodeAnalysis.VisualBasic.Features (14)
Debugging\VisualBasicBreakpointService.vb (2)
66If span.Length = 0 Then 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 (1)
76If breakpointSpan.Value.Length >= minLength Then
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (3)
157While node.Span.Length < span.Length AndAlso node.Parent.SpanStart = position 332Return BreakpointSpans.TryGetClosestBreakpointSpan(token.Parent, token.SpanStart, minLength:=token.Span.Length, span)
SplitOrMergeIfStatements\VisualBasicMergeConsecutiveIfStatementsCodeRefactoringProvider.vb (2)
29If span.Length = 0 OrElse 51If span.Length = 0 OrElse
SplitOrMergeIfStatements\VisualBasicMergeNestedIfStatementsCodeRefactoringProvider.vb (2)
29If span.Length = 0 OrElse 59If span.Length = 0 OrElse
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (3)
EditAndContinue\BreakpointSpansTests.vb (3)
53Assert.True(breakpointSpan.Length = 0) 61source.Substring(expectedSpan.Value.Start, expectedSpan.Value.Length), 63source.Substring(breakpointSpan.Start, breakpointSpan.Length)))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (26)
Scanner\ScannerTests.vb (6)
1121Assert.Equal(3, tk.Span.Length) 1122Assert.Equal(4, tk.FullSpan.Length) 1128Assert.Equal(2, tk.Span.Length) 1129Assert.Equal(3, tk.FullSpan.Length) 1135Assert.Equal(2, tk.Span.Length) 1136Assert.Equal(3, tk.FullSpan.Length)
Syntax\SyntaxFactsTest.vb (1)
1021Dim builder As New System.Text.StringBuilder(cu.FullSpan.Length * 2)
TestSyntaxNodes.vb (19)
771Assert.Equal(5, keyword.Span.Length) 772Assert.Equal(6, keyword.FullSpan.Length) 783Assert.Equal(5, keyword.Span.Length) 784Assert.Equal(12, keyword.FullSpan.Length) 792Assert.Equal(7, keyword.Span.Length) 793Assert.Equal(8, keyword.FullSpan.Length) 803Assert.Equal(7, keyword.Span.Length) 804Assert.Equal(16, keyword.FullSpan.Length) 816Assert.Equal(7, endTry.Span.Length) 817Assert.Equal(8, endTry.FullSpan.Length) 923Assert.Equal(0, eof.Span.Length) 927Assert.Equal(0, endIfStmt.Span.Length) 990Assert.Equal(6, kwModule.Span.Length) 991Assert.Equal(7, kwModule.FullSpan.Length) 996Assert.Equal(6, kwModule.Span.Length) 997Assert.Equal(7, kwModule.FullSpan.Length) 1736Assert.Equal(0, tree.GetRoot().FindToken(node.FullSpan.Length - 1).TrailingTrivia.Count) 2187Assert.Equal(sN.FullWidth, cS.FullSpan.Length) 2188Assert.Equal(sN.Width, cS.Span.Length)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (11)
CompilationTestUtils.vb (5)
1013New String("~"c, Math.Max(Math.Min(sourceLocation.SourceSpan.Length, lineText.Length - offsetInLine + 1), 1)) + Environment.NewLine 1058If loc1.SourceSpan.Length < loc2.SourceSpan.Length Then Return -1 1059If loc1.SourceSpan.Length > loc2.SourceSpan.Length Then Return 1
ParserTestUtilities.vb (6)
388Assert.True(0 <> node.Span.Length OrElse node.Kind = SyntaxKind.CompilationUnit, "Unexpected 0 width node: " & node.Kind.ToString & node.Span.ToString) 625If spanLength IsNot Nothing AndAlso CInt(spanLength) <> syntaxErrorSpan.Length Then 800Assert.True(0 <> node.Span.Length, "Unexpected 0 width node: " & node.Kind().ToString & node.Span.ToString) 805Assert.True(0 <> node.Span.Length OrElse node.IsKind(SyntaxKind.EndOfFileToken) OrElse node.IsKind(SyntaxKind.StatementTerminatorToken) OrElse node.IsKind(SyntaxKind.ColonToken), "Unexpected 0 width token: " & node.Kind().ToString & node.Span.ToString) 807Assert.True(0 <> tr.Span.Length, "Unexpected 0 width trivia: " & node.Kind().ToString & node.Span.ToString) 813Assert.True(0 <> tr.Span.Length, "Unexpected 0 width trivia: " & node.Kind().ToString & node.Span.ToString)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (18)
CaseCorrection\VisualBasicCaseCorrectionService.vb (1)
49If span.Length <= s_threshold Then
Classification\Worker.vb (1)
86If span.Length <> 0 AndAlso _textSpan.OverlapsWith(span) Then
CodeCleanup\Providers\AbstractTokensCodeCleanupProvider.vb (1)
57_spans.GetIntervalsThatOverlapWith(node.FullSpan.Start, node.FullSpan.Length).Any()
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (3)
335_spans.HasIntervalThatContains(span.Start, span.Length) AndAlso 452If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then 567Return node IsNot Nothing AndAlso node.Span.Length > 0
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)
79Dim leading = SyntaxFactory.ParseLeadingTrivia(text.Substring(trailing.FullSpan.Length))
Rename\VisualBasicRenameRewriterLanguageService.vb (3)
97newSpan = New TextSpan(oldSpan.Start, newSpan.Length) 237Me._renameSpansTracker.AddComplexifiedSpan(Me._documentId, oldSpan, New TextSpan(oldSpan.Start, newSpan.Length), Me._modifiedSubSpans) 295AddModifiedSpan(annotation.OriginalSpan, New TextSpan(token.Span.Start, newToken.Span.Length))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (2)
233(token.Span.Length = startLength OrElse 234(token.Span.Length > startLength AndAlso Not token.ToString().EndsWith(lastChar, StringComparison.Ordinal)))
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.ParsedSyntaxTree.vb (1)
57Return _root.FullSpan.Length
Microsoft.CodeAnalysis.Workspaces (86)
Classification\ClassifierHelper.cs (1)
268syntacticPartSpan.Start, syntacticPartSpan.Length, ref tempBuffer.AsRef(),
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (1)
87if (textSpan.Length > 0 && textSpan.OverlapsWith(_textSpan))
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (4)
161return newRoot.FullSpan.Length; 165return oldRoot.FullSpan.Length; 229return newRoot.FullSpan.Length; 233return oldRoot.FullSpan.Length;
CodeCleanup\AbstractCodeCleanerService.cs (2)
338var start = intervalTree.HasIntervalThatOverlapsWith(previousToken.SpanStart, previousToken.Span.Length) 343var end = intervalTree.HasIntervalThatOverlapsWith(nextToken.SpanStart, nextToken.Span.Length)
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (2)
105change.Span.Start, change.Span.Length, ref overlappingSpans); 108change.Span.Start, change.Span.Length, ref intersectingSpans);
FindSymbols\FindReferences\FindReferenceCache.cs (1)
202if (span.Start == index && span.Length == text.Length && isMatch(text, token, args))
FindSymbols\SyntaxTree\SyntaxTreeIndex_Persistence.cs (1)
51writer.WriteInt32(span.Length);
PatternMatching\AllLowerCamelCaseMatcher.cs (1)
156var maxCandidateHumpLength = candidateHump.Length;
PatternMatching\PatternMatcher.cs (8)
430if (patternPart.Length > candidatePart.Length) 437candidate, candidatePart.Start, patternPart.Length, 438pattern, patternPart.Start, patternPart.Length, compareOptions) == 0; 587matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length)); 597candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
Rename\RenameUtilities.cs (2)
274if (replaceInsideString.Substring(subSpan.Start, subSpan.Length) != matchText) 285startOffset += offset + subSpan.Length;
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (2)
371.Where(t => syntaxFactsService.IsStringLiteralOrInterpolatedStringLiteral(t) && t.Span.Length >= renameTextLength) 389.Where(t => t.Span.Length >= renameTextLength)
Shared\Extensions\FileLinePositionSpanExtensions.cs (4)
61startColumn = lines[startLine].SpanIncludingLineBreak.Length; 74endColumn = lines[endLine].SpanIncludingLineBreak.Length; 78startColumn = Math.Min(startColumn, lines[startLine].SpanIncludingLineBreak.Length); 79endColumn = Math.Min(endColumn, lines[endLine].SpanIncludingLineBreak.Length);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (10)
86currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 150if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 224var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 308oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 310var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 373oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 430: this(range.Span.Start, range.Span.Length, range.NewLength)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (1)
286if ((span2.Length == 0) || (span1.Start >= span2.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (1)
28=> this.HasIntervalThatIntersectsWith(span.Start, span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (1)
178index += result[^1].Span.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
69public int Length => _span.Length; 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (8)
196=> node.Span.Length; 199=> node.FullSpan.Length; 424d = x.Length - y.Length; 555if (token.Span.Length > 0 && position <= token.Span.End) 585if (token.Span.Length > 0 && token.SpanStart <= position) 641if (token.Span.Length == 0) 680if (token.Span.Length == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (2)
64=> token.Span.Length; 67=> token.FullSpan.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTriviaExtensions.cs (2)
10=> trivia.Span.Length; 13=> trivia.FullSpan.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (4)
413var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length); 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\ContextMutableIntervalTree.cs (2)
133currentNodeSpan.Length < resultSpan.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (1)
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)
61var sizeOfList = spanToFormat.Length / MagicTextLengthToTokensRatio;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (3)
244for (; i < span.Length; i++) 253if (i == span.Length && text.Length == newText.Length) 261span = new TextSpan(span.Start + i, span.Length - i);
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 (2)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 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 (1)
502for (var i = span.Start - this.Token1.Span.End; i < span.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
160Debug.Assert(spanToCheck.Length > 0); 177=> name.Substring(wordSpan.Start, wordSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (3)
23Debug.Assert(nameSpan.Length > 0); 37if (Current.Length == 0) 76return Current.Length > 0 && Current.End <= _nameSpan.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
74var sb = new StringBuilder(summaryElement.Span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
259WriteInteger(location.SourceSpan.Length);
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)
30writer.WriteInt32(WordSpan.Length);
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\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\Simplification\AbstractSimplificationService.cs (1)
169=> !spansTree.HasIntervalThatOverlapsWith(nodeOrToken.FullSpan.Start, nodeOrToken.FullSpan.Length);
Workspace\Solution\DocumentState.cs (1)
285if (change.Span.Length < MaxTextChangeRangeLength && change.NewLength < MaxTextChangeRangeLength)
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SolutionTests\SolutionTests.cs (1)
3814Assert.Equal(newRoot.FullSpan.Length, tree3.Length);
Microsoft.ML.InternalCodeAnalyzer (2)
ContractsCheckNameofFixProvider.cs (2)
92if (candidate.Span.Length < shortestSymbol) 95shortestSymbol = candidate.Span.Length;
Microsoft.VisualStudio.LanguageServices (4)
ValueTracking\TreeItemViewModel.cs (1)
116var highlightSpan = new TextSpan(spanStartPosition, TextSpan.Length);
Venus\ContainedDocument.cs (1)
519var snippetInRightText = rightText.Substring(spanInRightText.Start, spanInRightText.Length);
Venus\ContainedDocument.DocumentServiceProvider.cs (2)
109if (primarySpan.Length != span.Length) 318=> new(targetSpan.Start - excerptSpan.Start, targetSpan.Length);
Microsoft.VisualStudio.LanguageServices.CSharp (1)
SemanticSearch\SemanticSearchToolWindowImpl.cs (1)
468var 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 (3)
Debugging\VisualBasicBreakpointResolutionServiceTests.vb (1)
33source.Substring(expectedSpan.Value.Start, expectedSpan.Value.Length),
Venus\DocumentService_IntegrationTests.vb (2)
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)
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
140nodeToFix = root.FindNode(new TextSpan(nodeToFix.Span.Start + (typesModified * "partial".Length), nodeToFix.Span.Length), getInnermostNodeForTie: true);