1 write to Length
Microsoft.CodeAnalysis (1)
Text\TextSpan.cs (1)
35Length = length;
689 references to Length
Microsoft.CodeAnalysis (63)
Diagnostic\SourceLocation.cs (1)
130return base.GetDebuggerDisplay() + "\"" + _syntaxTree.ToString().Substring(_span.Start, _span.Length) + "\"";
DiagnosticAnalyzer\AnalysisScope.cs (1)
98if (filterSpanOpt.GetValueOrDefault().Start == 0 && filterSpanOpt.GetValueOrDefault().Length == filterFile.GetValueOrDefault().SourceTree!.Length)
InternalUtilities\TextChangeRangeExtensions.cs (10)
85currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 149if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 223var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion); 225oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 307oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 309var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 372oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 390builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 429: this(range.Span.Start, range.Span.Length, range.NewLength)
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 (2)
39deltaLength += change.NewLength - change.Span.Length; 344delta += (change.NewLength - change.Span.Length);
Text\CompositeText.cs (1)
83var count = span.Length;
Text\LargeText.cs (1)
188int count = span.Length;
Text\SourceText.cs (4)
492int spanLength = span.Length; 616var buffer = new char[Math.Min(span.Length, 1024)]; 682if (change.Span.Length == 0 && newTextLength == 0) 814newPosDelta += 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 (4)
41public override int Length => UnderlyingSpan.Length; 70return UnderlyingText.ToString(GetCompositeSpan(span.Start, span.Length)); 77return new SubText(UnderlyingText, GetCompositeSpan(span.Start, span.Length)); 83UnderlyingText.CopyTo(span.Start, destination, destinationIndex, span.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\TextLine.cs (1)
66span = 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 (62)
AbstractDocumentationCommentService.cs (1)
74var sb = new StringBuilder(summaryElement.Span.Length);
AbstractFormatEngine.cs (1)
133var result = new SegmentedList<SyntaxNode>(Math.Max(this.SpanToFormat.Length / magicLengthToNodesRatio, 4));
AbstractFormattingResult.cs (1)
83var oldText = (change.Span == span) ? originalString : originalString.Substring(change.Span.Start - span.Start, change.Span.Length);
AbstractTriviaFormatter.cs (1)
502for (var i = span.Start - this.Token1.Span.End; i < span.Length; i++)
AbstractVirtualCharService.cs (1)
178index += result[^1].Span.Length;
AnchorIndentationOperation.cs (1)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
BKTree.Builder.cs (2)
195_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 196_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
BKTree.cs (2)
124_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length), 130result.Add(new string(_concatenatedLowerCaseWords, characterSpan.Start, characterSpan.Length));
BKTree.Node.cs (1)
37writer.WriteInt32(WordSpan.Length);
FormattingAnalyzerHelper.cs (1)
38var offset = change.Span.Length - change.NewText.Length;
FormattingContext.AnchorData.cs (3)
47=> value.TextSpan.Length; 53=> value.TextSpan.Length; 59=> value.InseparableRegionSpan.Length;
FormattingContext.cs (5)
436var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length); 566var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length); 624var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length); 653var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length); 675=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
FormattingExtensions.cs (3)
261for (; i < span.Length; i++) 270if (i == span.Length && text.Length == newText.Length) 278span = new TextSpan(span.Start + i, span.Length - i);
IndentBlockOperation.cs (2)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 41Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
NamingStyle.cs (2)
160Debug.Assert(spanToCheck.Length > 0); 177=> name.Substring(wordSpan.Start, wordSpan.Length);
NamingStyle.WordSpanEnumerator.cs (3)
23Debug.Assert(nameSpan.Length > 0); 37if (Current.Length == 0) 76return Current.Length > 0 && Current.End <= _nameSpan.End;
NormalizedTextSpanCollection.cs (1)
286if ((span2.Length == 0) || (span1.Start >= span2.End))
SimpleIntervalTreeExtensions.cs (1)
16=> tree.HasIntervalThatIntersectsWith(span.Start, span.Length);
SuppressIntervalIntrospector.cs (2)
17=> value.TextSpan.Length; 23=> value.TextSpan.Length;
SuppressOperation.cs (1)
17Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
SymbolKey.SymbolKeyWriter.cs (1)
259WriteInteger(location.SourceSpan.Length);
SyntaxNodeExtensions.cs (8)
185=> node.Span.Length; 188=> node.FullSpan.Length; 441d = x.Length - y.Length; 572if (token.Span.Length > 0 && position <= token.Span.End) 602if (token.Span.Length > 0 && token.SpanStart <= position) 658if (token.Span.Length == 0) 697if (token.Span.Length == 0)
SyntaxTokenExtensions.cs (2)
64=> token.Span.Length; 67=> token.FullSpan.Length;
SyntaxTriviaExtensions.cs (2)
10=> trivia.Span.Length; 13=> trivia.FullSpan.Length;
TextChangeRangeExtensions.cs (10)
85currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 149if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 223var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion); 225oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 307oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 309var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 372oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 390builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 429: this(range.Span.Start, range.Span.Length, range.NewLength)
TextSpanIntervalIntrospector.cs (1)
15=> value.Length;
TokenStream.cs (1)
61var sizeOfList = spanToFormat.Length / MagicTextLengthToTokensRatio;
VirtualCharSequence.cs (2)
69public int Length => _span.Length; 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
AbstractUseConditionalExpressionCodeFixProvider.cs (3)
158if (condition.Span.Length + trueSyntax.Span.Length + falseSyntax.Span.Length > wrappingLength)
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)
137_changeDelta += change.NewLength - change.Span.Length;
Symbols\Source\SourceConstructorSymbolBase.cs (1)
221ctorInitializerLength = span.Length;
Symbols\Source\SourceMemberContainerSymbol.cs (2)
1085aggregateLength += syntaxRef.Span.Length; 1215return initializer.Syntax.Span.Length;
Symbols\Symbol.cs (1)
379if (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 (9)
CSharpVirtualCharService.cs (3)
212lineStart = lineSpan.Length > indentationLength 264index += charResults.Last().span.Length; 272index += charResults.Last().span.Length;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (4)
396return token.Span.Length == startDelimeterLength || 397(token.Span.Length > startDelimeterLength && endDelimeterLength < startDelimeterLength); 402return token.Span.Length == startDelimeterLength || 403(token.Span.Length > startDelimeterLength && token.Text[^1] != lastChar);
NullableImpactingSpanWalker.cs (1)
61if (_ignoredSpans.HasIntervalThatContains(node.SpanStart, node.Span.Length))
TriviaDataFactory.cs (1)
132var initialColumn = (token1.RawKind == 0) ? 0 : this.TreeInfo.GetOriginalColumn(Options.TabSize, token1) + token1.Span.Length;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
ConvertNamespaceTransform.cs (1)
148while (commonIndentation < indentation.Length && commonIndentation < textLine.Span.Length)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
122stack += token.Span.Length;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (7)
BlockCommentEditing\BlockCommentEditingCommandHandler.cs (1)
303if (span.Length < "/**/".Length)
Formatting\CSharpFormattingInteractionService.cs (1)
97var span = textSpan ?? new TextSpan(0, parsedDocument.Root.FullSpan.Length);
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (1)
125startToken = selectionSpan.Length == 0
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (1)
219if (token.Span.Length < (2 * quoteCount))
StringCopyPaste\StringCopyPasteHelpers.cs (3)
533for (var n = Math.Min(commonIndentPrefix.Length, lineWhitespaceSpan.Length); commonPrefixLength < n; commonPrefixLength++) 554if (spans.First().Length > 0 && text[spans.First().Start] == '"') 557if (spans.Last().Length > 0 && text[spans.Last().End - 1] == '"')
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (6)
EditAndContinue\BreakpointSpansTests.cs (2)
48Assert.True(breakpointSpan.Length == 0); 82itemInspector: span => "[|" + source.Substring(span.Start, span.Length) + "|]");
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
56var expectedText = source.Substring(expected.Start, expected.Length); 65var actualText = source.Substring(actual.Start, actual.Length);
EditAndContinue\SyntaxUtilitiesTests.cs (1)
23foreach (var oldNode in oldRoot.DescendantNodes().Where(n => n.FullSpan.Length > 0))
ExtractMethod\MiscTests.cs (1)
133view.TextBuffer.CurrentSnapshot, testDocument.SelectedSpans[0].Start, testDocument.SelectedSpans[0].Length), isReversed: false);
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
EmbeddedLanguages\Json\CSharpJsonParserTests.cs (1)
209element.Add(new XAttribute("Length", d.Span.Length));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
FlowAnalysis\RegionAnalysisTests.cs (1)
7910Assert.Equal(0, stmt.Span.Length);
Microsoft.CodeAnalysis.CSharp.Features (29)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
199amountToShift += (newRange.NewLength - newRange.Span.Length);
BraceCompletion\ParenthesisBraceCompletionService.cs (1)
51if (closeParen.Kind() != SyntaxKind.CloseParenToken || closeParen.Span.Length == 0)
BraceCompletion\StringLiteralBraceCompletionService.cs (1)
69token.Span.Length > 1 &&
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
53if (textSpan.Length > 0)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (1)
84var text = baseName.Substring(@break.Start, @break.Length);
ConvertBetweenRegularAndVerbatimString\AbstractConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider.cs (1)
179if (ch.Span.Length == 2 && ch.Rune.Value != 0)
ConvertNamespaceTransform.cs (1)
148while (commonIndentation < indentation.Length && commonIndentation < textLine.Span.Length)
ConvertToRawString\ConvertToRawStringHelpers.cs (2)
56if (ch.Span.Length > 1) 92if (ch.Span.Length > 1)
Debugging\CSharpBreakpointResolutionService.cs (1)
41if (span.Length == 0)
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (6)
145if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 162if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 179if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 196if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 234if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false) 251if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (5)
1793(commonForEachStatement.AwaitKeyword.Span.Length > 0) ? commonForEachStatement.AwaitKeyword.SpanStart : commonForEachStatement.ForEachKeyword.SpanStart, 1908=> (first.Length > 0 && second.Length > 0) ? TextSpan.FromBounds(first.Start, second.End) : (first.Length > 0) ? first : (second.Length > 0) ? second : defaultSpan;
EditAndContinue\SyntaxUtilities.cs (1)
169Debug.Assert(leftNode.FullSpan.Length > 0);
InlineHints\CSharpInlineTypeHintsService.cs (1)
118var trailingSpace = span.Length == 0;
NullableImpactingSpanWalker.cs (1)
61if (_ignoredSpans.HasIntervalThatContains(node.SpanStart, node.Span.Length))
SplitOrMergeIfStatements\CSharpMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
36if (span.Length == 0 || 51if (span.Length == 0 ||
SplitOrMergeIfStatements\CSharpMergeNestedIfStatementsCodeRefactoringProvider.cs (2)
36if (span.Length == 0 || 51if (span.Length == 0 ||
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
65if (textSpan.Length > 0)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\RecordTests.cs (2)
576Assert.Equal(0, ctor.Parameters[1].Locations.Single().SourceSpan.Length); 604Assert.Equal(0, ctor.Parameters[1].Locations.Single().SourceSpan.Length);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\LocationTests.cs (1)
48Assert.Equal(length, pos.SourceSpan.Length);
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)
3464Assert.True(trivia.Span.Length == 8); 3543Assert.Equal(22, trivia.Span.Length); 3556Assert.Equal(16, trivia.Span.Length); 3566Assert.Equal(2, trivia.Span.Length); 3571Assert.Equal(13, trivia.Span.Length); 3580Assert.Equal(16, trivia.Span.Length); 3589Assert.Equal(2, trivia.Span.Length); 3593Assert.Equal(34, trivia.Span.Length); 3601Assert.Equal(16, trivia1.Span.Length); 3611Assert.Equal(2, trivia2.Span.Length); 3616Assert.Equal(15, trivia3.Span.Length); 3621Assert.Equal(24, trivia4.Span.Length); 3634Assert.Equal(16, trivia1.Span.Length); 3644Assert.Equal(2, trivia2.Span.Length); 3649Assert.Equal(24, trivia3.Span.Length); 3682Assert.Equal(22, trivia.Span.Length); 3690Assert.Equal(16, trivia.Span.Length); 3695Assert.Equal(2, trivia.Span.Length); 3700Assert.Equal(13, trivia.Span.Length); 3709Assert.Equal(16, trivia.Span.Length); 3713Assert.Equal(2, trivia.Span.Length); 3717Assert.Equal(34, trivia.Span.Length); 3725Assert.Equal(16, trivia1.Span.Length); 3730Assert.Equal(2, trivia2.Span.Length); 3735Assert.Equal(15, trivia3.Span.Length); 3740Assert.Equal(24, trivia4.Span.Length);
Parsing\ScriptParsingTests.cs (1)
9743Assert.Equal(0, endOfDirective.Span.Length);
Syntax\SyntaxNodeTests.cs (20)
1755Assert.Equal(rootNode.FullSpan.Length, rootNode.ToFullString().Length); 1756Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 1773Assert.Equal(rootNode.FullSpan.Length, rootNode.ToFullString().Length); 1774Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 3682Assert.Equal(0, idToken.LeadingTrivia.Span.Length); // zero-width elastic trivia 3685Assert.Equal(0, idToken.TrailingTrivia.Span.Length); // zero-width elastic trivia 3698Assert.Equal(1, idToken.LeadingTrivia.Span.Length); 3701Assert.Equal(2, idToken.TrailingTrivia.Span.Length); 3707Assert.Equal(0, namedNode.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3710Assert.Equal(0, namedNode.GetTrailingTrivia().Span.Length); // zero-width elastic trivia 3723Assert.Equal(1, namedNode.GetLeadingTrivia().Span.Length); 3726Assert.Equal(2, namedNode.GetTrailingTrivia().Span.Length); 3732Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3735Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia 3741Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3744Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia 3764Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3767Assert.Equal(2, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia 3773Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia 3776Assert.Equal(2, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia
Microsoft.CodeAnalysis.CSharp.Workspaces (15)
Classification\ClassificationHelpers.cs (2)
533if (token.Span.Length == span.Length)
Classification\Worker.cs (1)
62=> span.Length > 0 && _textSpan.OverlapsWith(span);
CSharpVirtualCharService.cs (3)
212lineStart = lineSpan.Length > indentationLength 264index += charResults.Last().span.Length; 272index += charResults.Last().span.Length;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (4)
396return token.Span.Length == startDelimeterLength || 397(token.Span.Length > startDelimeterLength && endDelimeterLength < startDelimeterLength); 402return token.Span.Length == startDelimeterLength || 403(token.Span.Length > startDelimeterLength && token.Text[^1] != lastChar);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
122stack += token.Span.Length;
Rename\CSharpRenameRewriterLanguageService.cs (2)
111newSpan = new TextSpan(oldSpan.Start, newSpan.Length); 320_renameSpansTracker.AddComplexifiedSpan(_documentId, oldSpan, new TextSpan(oldSpan.Start, newSpan.Length), _modifiedSubSpans);
TriviaDataFactory.cs (1)
132var initialColumn = (token1.RawKind == 0) ? 0 : this.TreeInfo.GetOriginalColumn(Options.TabSize, token1) + token1.Span.Length;
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.ParsedSyntaxTree.cs (1)
56=> _root.FullSpan.Length;
Microsoft.CodeAnalysis.EditorFeatures (10)
Formatting\FormatCommandHandler.cs (1)
68using (Logger.LogBlock(FunctionId.CommandHandler_FormatCommand, KeyValueLogMessage.Create(LogType.UserAction, m => m["Span"] = selectionOpt?.Length ?? -1), cancellationToken))
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (1)
345edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Interactive\InteractiveWorkspace.cs (1)
67edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Interactive\SendToInteractiveSubmissionProvider.cs (1)
74Select(span => new SnapshotSpan(snapshot, span.Start, span.Length));
Remote\SolutionChecksumUpdater.cs (1)
209if (textChanges.Count == 1 && textChanges[0].Span.Length == oldText.Length)
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (1)
169if (initialCheck && token.Span.Length != this.OriginalName.Length)
Structure\AbstractStructureTaggerProvider.cs (1)
246if (region.TextSpan.Length > 0)
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.DiagnosticsTests.Utilities (2)
MoveType\AbstractMoveTypeTest.cs (1)
58var codeActionTitle = string.Format(RenameTypeCodeActionTitle, expectedText.Substring(span.Start, span.Length));
SplitComments\AbstractSplitCommentCommandHandlerTests.cs (1)
69snapshotSpans.Add(new SnapshotSpan(originalSnapshot, new Span(selection.Start, selection.Length)));
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (13)
BraceHighlighting\MultiCharacterBraceHighlightingTests.cs (2)
39Debug.Assert(text.Substring(braces.Value.LeftSpan.Start, braces.Value.LeftSpan.Length) == "<@"); 40Debug.Assert(text.Substring(braces.Value.RightSpan.Start, braces.Value.RightSpan.Length) == "@>");
Classification\AbstractClassifierTests.cs (1)
71var actualFormatted = actualOrdered.Select(a => new FormattedClassification(allCode.Substring(a.TextSpan.Start, a.TextSpan.Length), a.ClassificationType));
Classification\ClassificationTestHelper.cs (1)
54var text = actualText.Substring(actual.TextSpan.Start, actual.TextSpan.Length);
CompleteStatement\AbstractCompleteStatementTests.cs (1)
97view.Selection.Select(new SnapshotSpan(view.TextSnapshot, selectedSpan.Start, selectedSpan.Length), isReversed);
DocumentationComments\AbstractDocumentationCommentTests.cs (1)
158view.Selection.Select(new SnapshotSpan(view.TextSnapshot, selectedSpan.Start, selectedSpan.Length), isReversed);
EditAndContinue\EditAndContinueTestHelpers.cs (1)
464.ThenByDescending(partners => partners.Key.Span.Length)
KeywordHighlighting\AbstractKeywordHighlighterTests.cs (1)
59for (var i = 0; i <= cursorSpan.Length; i++)
Workspaces\TestHostDocument.cs (2)
244_textView.Selection.Select(new SnapshotSpan(_textView.TextSnapshot, new Span(span.Start, span.Length)), false); 333edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Workspaces\TestWorkspace.cs (3)
588var span = new Span(matchingSpan.Start, matchingSpan.Length); 608currentPositionInProjectionBuffer += matchingSpan.Length; 642var markupSpanEndExclusive = markupSpan.Start + markupSpan.Length;
Microsoft.CodeAnalysis.EditorFeatures.Text (3)
Extensions.SnapshotSourceText.cs (1)
181var 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 (9)
EditorAdapter\SpanExtensionsTest.cs (1)
26Assert.Equal(length, textSpan.Length);
RenameTracking\RenameTrackingTaggerProviderTests.cs (5)
359state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "cation"); 372state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Complex"); 385state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Dog"); 404state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "_"); 810state.EditorOperations.ReplaceText(new Span(textSpan.Start, textSpan.Length), "Go");
Snippets\RoslynLSPSnippetConvertTests.cs (2)
495var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length)); 512var identifier = text.Substring(spans[0].Start, spans[0].Length);
Utilities\PatternMatcherTests.cs (1)
421result.Add(identifier.Substring(span.Start, span.Length));
Microsoft.CodeAnalysis.EditorFeatures.Wpf (2)
InlineRename\UI\Adornment\RenameFlyout.xaml.cs (1)
52IdentifierTextBox.Select(_viewModel.StartingSelection.Start, _viewModel.StartingSelection.Length);
Interactive\InteractiveDocumentNavigationService.cs (1)
62var snapshotSpan = new SnapshotSpan(textSnapshot, textSpan.Start, textSpan.Length);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (6)
Classification\ClassificationTests.vb (1)
73Assert.Equal(New TextSpan(0, referenceSpan.Length), spansAndHighlightSpan.HighlightSpan)
Classification\SyntacticChangeRangeComputerTests.vb (2)
39annotatedSpan.Length + newText.Length - spans(0).Length)
GoToDefinition\GoToDefinitionTestsBase.vb (1)
87Assert.True(expected.Length = 0)
Rename\RenameEngineResult.vb (1)
228newText = newToken.ToFullString().Substring(newLocation.Start - newToken.FullSpan.Start, newLocation.Length)
Rename\RenameViewModelTests.vb (1)
580edit.Replace(token.SpanStart, token.Span.Length, newName)
Microsoft.CodeAnalysis.Features (39)
AbstractUseConditionalExpressionCodeFixProvider.cs (3)
158if (condition.Span.Length + trueSyntax.Span.Length + falseSyntax.Span.Length > wrappingLength)
BraceMatching\AbstractBraceMatcher.cs (1)
35where tok.Span.Length > 0
ClassifiedSpansAndHighlightSpanFactory.cs (1)
76length: narrowSpan.Length);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (3)
155var delta = textChange.NewText.Length - textChange.Span.Length; 162currentSpan = new TextSpan(newStart, currentSpan.Length); 168var 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)
144var referenceSpan = new TextSpan(spanStart, token.Span.Length); 156token.Span.Length, 164referenceSpan.Length,
CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
40if (node.Span.Length > 0)
Completion\Utilities.cs (2)
39var sumOfDeltas = changes.Sum(c => c.NewText!.Length - c.Span.Length); 40var totalNewSpan = new TextSpan(totalOldSpan.Start, totalOldSpan.Length + sumOfDeltas);
Debugging\DebugDataTipInfo.cs (1)
21=> Span.Length == 0 && Span.Start == 0 && Text == null;
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (1)
1630if (TryGetActiveSpan(statement, statementPart, minLength: statement.Span.Length, out var span))
EmbeddedLanguages\Classification\AbstractFallbackEmbeddedLanguageClassifier.cs (1)
48if (vc.Span.Length > 1)
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
114properties.Add(LengthKey, textChange.Span.Length.ToString());
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (1)
105properties.Add(LengthKey, textChange.Span.Length.ToString());
FormattingAnalyzerHelper.cs (1)
38var offset = change.Span.Length - change.NewText.Length;
QuickInfo\IndentationHelper.cs (2)
58if (spanBeforeDeletion.Length > 0) 70if (span.Length > 0)
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
163if (span.Length != 0)
Shared\Naming\IdentifierNameParts.cs (1)
80words.Add(name.Substring(part.Start, part.Length));
Snippets\RoslynLSPSnippetConverter.cs (1)
49for (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)
55if (span.TextSpan.Length > 0)
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (1)
39if (textSpan.Length > 0 &&
TaskList\AbstractTaskListService.cs (1)
139var message = postfixLength == 0 ? fullString : fullString[..(fullSpan.Length - postfixLength)];
Wrapping\ChainedExpression\ChainedExpressionCodeActionComputer.cs (2)
137var position = _firstPeriodIndentationTrivia.FullSpan.Length + NormalizedWidth(firstChunk); 150position = indentationTrivia.FullSpan.Length;
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (3)
287currentOffset += item.Span.Length; 304currentOffset = indentationTrivia.FullWidth() + item.Span.Length; 314currentOffset += comma.Span.Length;
Microsoft.CodeAnalysis.LanguageServer.Protocol (13)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (1)
385var newSpan = new TextSpan(start, start >= tree.Length ? 0 : diagnosticSpan.Length);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (1)
114var logPerformanceInfo = range.HasValue && blockForData && range.Value.Length < text.Length;
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (1)
684if (selectionOpt?.Length > 0)
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (1)
43if (span.Length > 0)
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
38var rangeSpan = (range != null) ? ProtocolConversions.RangeToTextSpan(range, text) : new TextSpan(0, root.FullSpan.Length);
Handler\InlineCompletions\InlineCompletionsHandler.cs (4)
172var fieldInSnippetContext = GetTextSpanInContextOfSnippet(fieldInFormattedText.Start, spanContainingFormattedSnippet.Start, fieldInFormattedText.Length); 181var caretInSnippetContext = GetTextSpanInContextOfSnippet(caretInFormattedText.Start, spanContainingFormattedSnippet.Start, caretInFormattedText.Length); 193var amountToAdjust = textChangesBefore.Sum(t => t.NewText!.Length - t.Span.Length); 194return new TextSpan(originalSpan.Start + amountToAdjust, originalSpan.Length);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (2)
160if (desiredCaretLinePosition.Character > caretLine.Span.Length) 204var amountToIndent = desiredCaretLinePosition.Character - lineToIndent.Span.Length;
Handler\SemanticTokens\SemanticTokensHelpers.cs (2)
212if (textSpan.Length > 0) 301var tokenLength = originalTextSpan.Length;
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
SemanticTokens\AbstractSemanticTokensTests.cs (1)
88var lineLength = text.Lines[currentLine].SpanIncludingLineBreak.Length;
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
189writer.WriteCompressedUInt((uint)classifiedSpan.TextSpan.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)
38Assert.Equal(0, text.Lines[0].Span.Length); 346Assert.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 (16)
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 (4)
1530Debug.Assert(staticInitializersSyntaxLength = If(staticInitializers.IsDefaultOrEmpty, 0, staticInitializers.Sum(Function(s) s.Sum(Function(i) If(Not i.IsMetadataConstant, i.Syntax.Span.Length, 0))))) 1531Debug.Assert(instanceInitializersSyntaxLength = If(instanceInitializers.IsDefaultOrEmpty, 0, instanceInitializers.Sum(Function(s) s.Sum(Function(i) i.Syntax.Span.Length)))) 1590aggregateSyntaxLength += initializer.Syntax.Span.Length 3241aggregateLength += syntaxRef.Span.Length
Syntax\VisualBasicSyntaxTree.ParsedSyntaxTree.vb (1)
97Return _root.FullSpan.Length
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
SyntaxTreeExtensions.vb (2)
233(token.Span.Length = startLength OrElse 234(token.Span.Length > startLength AndAlso Not token.ToString().EndsWith(lastChar, StringComparison.Ordinal)))
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.EditorFeatures.UnitTests (10)
EditAndContinue\BreakpointSpansTests.vb (4)
53Assert.True(breakpointSpan.Length = 0) 61source.Substring(expectedSpan.Value.Start, expectedSpan.Value.Length), 63source.Substring(breakpointSpan.Start, breakpointSpan.Length))) 81itemInspector:=Function(span) "[|" & source.Substring(span.Start, span.Length) & "|]")
EditAndContinue\SyntaxUtilitiesTests.vb (1)
17For Each oldNode In oldRoot.DescendantNodes().Where(Function(n) n.FullSpan.Length > 0)
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (2)
44Dim expectedText As String = source.Substring(expectedSpan.Start, expectedSpan.Length) 52Dim actualText = source.Substring(actualSpan.Start, actualSpan.Length)
LineCommit\CommitWithViewTests.vb (1)
790Dim snapshotspan = New SnapshotSpan(testData.Buffer.CurrentSnapshot, New Span(onlyTextSpan.Start, onlyTextSpan.Length))
SimplifyTypeNames\SimplifyTypeNamesTests.vb (2)
1874Assert.Equal(span.Length, "A.B".Length) 1908Assert.Equal(span.Length, "System".Length)
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)
119If _ignoredSpans IsNot Nothing AndAlso _ignoredSpans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then 131If _ignoredSpans IsNot Nothing AndAlso _ignoredSpans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then 143If _ignoredSpans IsNot Nothing AndAlso _ignoredSpans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then 175If _ignoredSpans IsNot Nothing AndAlso _ignoredSpans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then
EditAndContinue\BreakpointSpans.vb (1)
76If breakpointSpan.Value.Length >= minLength Then
EditAndContinue\SyntaxUtilities.vb (1)
101Debug.Assert(leftNode.FullSpan.Length > 0)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (2)
588While node.Span.Length < span.Length AndAlso node.Parent.SpanStart = position
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.Syntax.UnitTests (89)
Scanner\ScanConditionalTests.vb (11)
22Assert.Equal(1, res.Length) 45Assert.Equal(11, res.Length) 58Assert.Equal(6, res.Length) 81Assert.Equal(11, res.Length) 90Assert.Equal(7, res.Length) 98Assert.Equal(2, res.Length) 121Assert.Equal(7, res.Length) 130Assert.Equal(9, res.Length) 139Assert.Equal(11, res.Length) 148Assert.Equal(8, res.Length) 157Assert.Equal(8, res.Length)
Scanner\ScannerTests.vb (58)
112Assert.True(trivia.Span.Length = 8) 166Assert.True(trivia.Span.Length = 8) 197Assert.Equal(trivia.Span.Length, 22) 209Assert.Equal(trivia.Span.Length, 16) 218Assert.Equal(trivia.Span.Length, 2) 223Assert.Equal(trivia.Span.Length, 13) 232Assert.Equal(trivia.Span.Length, 16) 240Assert.Equal(trivia.Span.Length, 2) 244Assert.Equal(trivia.Span.Length, 34) 252Assert.Equal(trivia1.Span.Length, 16) 261Assert.Equal(trivia2.Span.Length, 2) 266Assert.Equal(trivia3.Span.Length, 15) 271Assert.Equal(trivia4.Span.Length, 24) 307Assert.Equal(trivia.Span.Length, 22) 319Assert.Equal(trivia.Span.Length, 16) 328Assert.Equal(trivia.Span.Length, 2) 333Assert.Equal(trivia.Span.Length, 13) 342Assert.Equal(trivia.Span.Length, 16) 350Assert.Equal(trivia.Span.Length, 2) 354Assert.Equal(trivia.Span.Length, 34) 362Assert.Equal(trivia1.Span.Length, 16) 371Assert.Equal(trivia2.Span.Length, 2) 376Assert.Equal(trivia3.Span.Length, 15) 381Assert.Equal(trivia4.Span.Length, 24) 397Assert.Equal(trivia.Span.Length, 22) 405Assert.Equal(trivia.Span.Length, 2) 410Assert.Equal(trivia.Span.Length, 27) 438Assert.Equal(trivia.Span.Length, 22) 450Assert.Equal(trivia.Span.Length, 16) 459Assert.Equal(trivia.Span.Length, 2) 464Assert.Equal(trivia.Span.Length, 13) 473Assert.Equal(trivia.Span.Length, 16) 481Assert.Equal(trivia.Span.Length, 2) 485Assert.Equal(trivia.Span.Length, 34) 493Assert.Equal(trivia1.Span.Length, 16) 502Assert.Equal(trivia2.Span.Length, 2) 507Assert.Equal(trivia3.Span.Length, 15) 512Assert.Equal(trivia4.Span.Length, 24) 548Assert.Equal(trivia.Span.Length, 22) 560Assert.Equal(trivia.Span.Length, 16) 569Assert.Equal(trivia.Span.Length, 2) 574Assert.Equal(trivia.Span.Length, 13) 583Assert.Equal(trivia.Span.Length, 16) 591Assert.Equal(trivia.Span.Length, 2) 595Assert.Equal(trivia.Span.Length, 34) 603Assert.Equal(trivia1.Span.Length, 16) 612Assert.Equal(trivia2.Span.Length, 2) 617Assert.Equal(trivia3.Span.Length, 15) 622Assert.Equal(trivia4.Span.Length, 24) 638Assert.Equal(trivia.Span.Length, 22) 646Assert.Equal(trivia.Span.Length, 2) 651Assert.Equal(trivia.Span.Length, 27) 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)
1020Dim 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 (12)
CompilationTestUtils.vb (5)
1000New String("~"c, Math.Max(Math.Min(sourceLocation.SourceSpan.Length, lineText.Length - offsetInLine + 1), 1)) + Environment.NewLine 1045If loc1.SourceSpan.Length < loc2.SourceSpan.Length Then Return -1 1046If loc1.SourceSpan.Length > loc2.SourceSpan.Length Then Return 1
ParserTestUtilities.vb (7)
388Assert.True(0 <> node.Span.Length OrElse node.Kind = SyntaxKind.CompilationUnit, "Unexpected 0 width node: " & node.Kind.ToString & node.Span.ToString) 467<%= If(e.Location.IsInSource, New XAttribute("length", e.Location.SourceSpan.Length), Nothing) %> 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 (19)
CaseCorrection\VisualBasicCaseCorrectionService.vb (1)
49If span.Length <= s_threshold Then
Classification\Worker.vb (1)
85If 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 (4)
154node, newNode, Function(n) n.Expression.Span.Length > 0, Function(n) n.ArgumentList, Function(n) n.WithArgumentList(SyntaxFactory.ArgumentList()), semanticChecker) 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))
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb\SyntaxTreeExtensions.vb (2)
233(token.Span.Length = startLength OrElse 234(token.Span.Length > startLength AndAlso Not token.ToString().EndsWith(lastChar, StringComparison.Ordinal)))
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))
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.ParsedSyntaxTree.vb (1)
52Return _root.FullSpan.Length
Microsoft.CodeAnalysis.Workspaces (108)
AbstractDocumentationCommentService.cs (1)
74var sb = new StringBuilder(summaryElement.Span.Length);
AbstractFormatEngine.cs (1)
133var result = new SegmentedList<SyntaxNode>(Math.Max(this.SpanToFormat.Length / magicLengthToNodesRatio, 4));
AbstractFormattingResult.cs (1)
83var oldText = (change.Span == span) ? originalString : originalString.Substring(change.Span.Start - span.Start, change.Span.Length);
AbstractTriviaFormatter.cs (1)
502for (var i = span.Start - this.Token1.Span.End; i < span.Length; i++)
AbstractVirtualCharService.cs (1)
178index += result[^1].Span.Length;
AnchorIndentationOperation.cs (1)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
BKTree.Builder.cs (2)
195_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 196_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
BKTree.cs (2)
124_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length), 130result.Add(new string(_concatenatedLowerCaseWords, characterSpan.Start, characterSpan.Length));
BKTree.Node.cs (1)
37writer.WriteInt32(WordSpan.Length);
Classification\ClassifiedSpanIntervalIntrospector.cs (1)
16=> value.TextSpan.Length;
Classification\ClassifierHelper.cs (2)
170if (span.TextSpan.Length == 0) 220syntacticPart.TextSpan.Start, syntacticPart.TextSpan.Length, ref tempBuffer.AsRef());
Classification\IRemoteSemanticClassificationService.cs (1)
82classificationTriples.Add(textSpan.Length);
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (1)
79if (textSpan.Length > 0 && textSpan.OverlapsWith(_textSpan))
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (4)
163return newRoot.FullSpan.Length; 167return oldRoot.FullSpan.Length; 233return newRoot.FullSpan.Length; 237return oldRoot.FullSpan.Length;
CodeCleanup\AbstractCodeCleanerService.cs (2)
339var start = intervalTree.HasIntervalThatOverlapsWith(previousToken.SpanStart, previousToken.Span.Length) 344var end = intervalTree.HasIntervalThatOverlapsWith(nextToken.SpanStart, nextToken.Span.Length)
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (3)
24int IIntervalIntrospector<TextChange>.GetLength(TextChange value) => value.Span.Length; 105change.Span.Start, change.Span.Length, ref overlappingSpans); 108change.Span.Start, change.Span.Length, ref intersectingSpans);
Editing\ImportAdderService.cs (1)
48Func<SyntaxNode, bool> overlapsWithSpan = n => spansTree.HasIntervalThatOverlapsWith(n.FullSpan.Start, n.FullSpan.Length);
FindSymbols\FindReferences\FindReferenceCache.cs (1)
147if (span.Start == index && span.Length == identifier.Length && IsMatch(token))
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (1)
198writer.WriteInt32(Span.Length);
FormattingContext.AnchorData.cs (3)
47=> value.TextSpan.Length; 53=> value.TextSpan.Length; 59=> value.InseparableRegionSpan.Length;
FormattingContext.cs (5)
436var intervals = tree.GetIntervalsThatContain(textSpan.Start, textSpan.Length); 566var anchorData = _anchorTree.GetIntervalsThatOverlapWith(baseAnchorData.TextSpan.Start, baseAnchorData.TextSpan.Length); 624var data = _suppressWrappingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length); 653var data = _suppressSpacingTree.GetSmallestEdgeExclusivelyContainingInterval(textSpan.Start, textSpan.Length); 675=> _suppressFormattingTree.HasIntervalThatIntersectsWith(textSpan.Start, textSpan.Length);
FormattingExtensions.cs (3)
261for (; i < span.Length; i++) 270if (i == span.Length && text.Length == newText.Length) 278span = new TextSpan(span.Start + i, span.Length - i);
IndentBlockOperation.cs (2)
19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 41Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (4)
245currentPositionDelta += (commentChangesList[commentChangeIndex].NewText.Length - commentChangesList[commentChangeIndex].Span.Length); 253currentPositionDelta += (mergedChange.NewText.Length - mergedChange.Span.Length); 270currentPositionDelta += (mergedChange.NewText.Length - mergedChange.Span.Length); 279currentPositionDelta += (commentChangesList[commentChangeIndex].NewText.Length - commentChangesList[commentChangeIndex].Span.Length);
NamingStyle.cs (2)
160Debug.Assert(spanToCheck.Length > 0); 177=> name.Substring(wordSpan.Start, wordSpan.Length);
NamingStyle.WordSpanEnumerator.cs (3)
23Debug.Assert(nameSpan.Length > 0); 37if (Current.Length == 0) 76return Current.Length > 0 && Current.End <= _nameSpan.End;
NormalizedTextSpanCollection.cs (1)
286if ((span2.Length == 0) || (span1.Start >= span2.End))
PatternMatching\AllLowerCamelCaseMatcher.cs (1)
167var maxCandidateHumpLength = candidateHump.Length;
PatternMatching\PatternMatcher.cs (8)
396if (patternPart.Length > candidatePart.Length) 403candidate, candidatePart.Start, patternPart.Length, 404pattern, patternPart.Start, patternPart.Length, compareOptions) == 0; 549matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length)); 559candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
897var length = renameLocation.Location.SourceSpan.Length;
Rename\ConflictEngine\RenamedSpansTracker.cs (4)
63adjustedStartingPosition += newSpan.Length - oldSpan.Length; 76adjustedStartingPosition += c.NewSpan.Length - c.OriginalSpan.Length;
Rename\RenameUtilities.cs (2)
268if (replaceInsideString.Substring(subSpan.Start, subSpan.Length) != matchText) 279startOffset += offset + subSpan.Length;
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (2)
364.Where(t => syntaxFactsService.IsStringLiteralOrInterpolatedStringLiteral(t) && t.Span.Length >= renameTextLength) 382.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);
Shared\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
369if (p.Length > 0 && char.IsLetter(name[p.Start])) 370return name.Substring(p.Start, p.Length).ToCamelCase();
SimpleIntervalTreeExtensions.cs (1)
16=> tree.HasIntervalThatIntersectsWith(span.Start, span.Length);
Simplification\AbstractSimplificationService.cs (1)
106=> !spansTree.HasIntervalThatOverlapsWith(nodeOrToken.FullSpan.Start, nodeOrToken.FullSpan.Length);
SuppressIntervalIntrospector.cs (2)
17=> value.TextSpan.Length; 23=> value.TextSpan.Length;
SuppressOperation.cs (1)
17Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
SymbolKey.SymbolKeyWriter.cs (1)
259WriteInteger(location.SourceSpan.Length);
SyntaxNodeExtensions.cs (8)
185=> node.Span.Length; 188=> node.FullSpan.Length; 441d = x.Length - y.Length; 572if (token.Span.Length > 0 && position <= token.Span.End) 602if (token.Span.Length > 0 && token.SpanStart <= position) 658if (token.Span.Length == 0) 697if (token.Span.Length == 0)
SyntaxTokenExtensions.cs (2)
64=> token.Span.Length; 67=> token.FullSpan.Length;
SyntaxTriviaExtensions.cs (2)
10=> trivia.Span.Length; 13=> trivia.FullSpan.Length;
TextChangeRangeExtensions.cs (10)
85currentNewEnd = currentNewEnd + newChange.NewLength - newChange.Span.Length; 149if (oldChange.Span.Length == 0 && oldChange.NewLength == 0) 223var oldChangeLeadingDeletion = Math.Min(oldChange.Span.Length, oldChangeLeadingInsertion); 225oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 307oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 309var newDeletion = newChange.SpanLength + oldChange.Span.Length - oldChange.NewLength; 372oldDelta = oldDelta - oldChange.Span.Length + oldChange.NewLength; 390builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength); 429: this(range.Span.Start, range.Span.Length, range.NewLength)
TextSpanIntervalIntrospector.cs (1)
15=> value.Length;
TokenStream.cs (1)
61var sizeOfList = spanToFormat.Length / MagicTextLengthToTokensRatio;
VirtualCharSequence.cs (2)
69public int Length => _span.Length; 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
Workspace\Solution\DocumentState.cs (1)
270if (change.Span.Length < MaxTextChangeRangeLength && change.NewLength < MaxTextChangeRangeLength)
Microsoft.CodeAnalysis.Workspaces.UnitTests (5)
SolutionTests\SolutionTests.cs (1)
3176Assert.Equal(newRoot.FullSpan.Length, tree3.Length);
SyntaxReferenceTests.cs (4)
68Assert.Equal(0, node.FullSpan.Length); 90Assert.Equal(0, node.FullSpan.Length); 164Assert.Equal(0, node.FullSpan.Length); 192Assert.Equal(0, node.Span.Length);
Microsoft.VisualStudio.IntegrationTest.Utilities (1)
InProcess\Editor_InProc.cs (1)
626return matchingTags.Select(t => t.Span.GetSpans(view.TextBuffer).Single().Span.ToTextSpan()).SelectMany(t => new List<int> { t.Start, t.Length }).ToArray();
Microsoft.VisualStudio.LanguageServices (11)
CodeLens\RemoteCodeLensReferencesService.cs (2)
195result.Span.Length, 219reference.Value.MappedSpan.Length);
ProjectSystem\TextEditApplication.cs (1)
42edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
ValueTracking\TreeItemViewModel.cs (1)
116var highlightSpan = new TextSpan(spanStartPosition, TextSpan.Length);
Venus\ContainedDocument.cs (2)
388var spanInOriginalText = new TextSpan(offsetInOriginalText + spanInLeftText.Start, spanInLeftText.Length); 522var snippetInRightText = rightText.Substring(spanInRightText.Start, spanInRightText.Length);
Venus\ContainedDocument.DocumentServiceProvider.cs (5)
110if (primarySpan.Length != span.Length) 238builder.Add(new ClassifiedSpan(new TextSpan(0, contentSpan.Length), ClassificationTypeNames.Text)); 243if (lastSpan.End < contentSpan.Length) 245builder.Add(new ClassifiedSpan(new TextSpan(lastSpan.End, contentSpan.Length - lastSpan.End), ClassificationTypeNames.Text)); 319=> new(targetSpan.Start - excerptSpan.Start, targetSpan.Length);
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
536edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
Microsoft.VisualStudio.LanguageServices.New.IntegrationTests (2)
InProcess\EditorInProcess.cs (1)
196view.SetMultiSelection(positions.Select(p => new SnapshotSpan(subjectBuffer.CurrentSnapshot, p.Start, p.Length)));
InProcess\EditorVerifierInProcess.cs (1)
264Assert.Equal(expectedTag.textSpan.Length, actualTaggedSpan.Span.Length);
Microsoft.VisualStudio.LanguageServices.Test.Utilities2 (1)
CodeModel\Mocks\MockTextPoint.vb (1)
35result += textLine.Span.Length + 1
Microsoft.VisualStudio.LanguageServices.UnitTests (8)
Debugging\VisualBasicBreakpointResolutionServiceTests.vb (2)
33source.Substring(expectedSpan.Value.Start, expectedSpan.Value.Length), 35source.Substring(result.TextSpan.Start, result.TextSpan.Length)))
Venus\DocumentService_IntegrationTests.vb (2)
326Return 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 (4)
156Dim actualFormatted = result.Value.ClassifiedSpans.Select(Function(a) New FormattedClassification(content.Substring(a.TextSpan.Start, a.TextSpan.Length), a.ClassificationType)) 195Dim actualFormatted = result.Value.ClassifiedSpans.Select(Function(a) New FormattedClassification(content.Substring(a.TextSpan.Start, a.TextSpan.Length), a.ClassificationType)) 250Dim actualFormatted = result.Value.ClassifiedSpans.Select(Function(a) New FormattedClassification(content.Substring(a.TextSpan.Start, a.TextSpan.Length), a.ClassificationType)) 294Dim actualFormatted = result.Value.ClassifiedSpans.Select(Function(a) New FormattedClassification(content.Substring(a.TextSpan.Start, a.TextSpan.Length), a.ClassificationType))