14 overrides of Length
GenerateDocumentationAndConfigFiles (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequenceSourceText.cs (1)
27public override int Length => _virtualChars.Count;
Microsoft.CodeAnalysis (7)
Text\ChangedText.cs (1)
112public override int Length
Text\CompositeText.cs (1)
57public override int Length
Text\LargeText.cs (1)
155public override int Length => _length;
Text\SourceText.cs (1)
1387public override int Length => _underlying.Length;
Text\StringBuilderText.cs (1)
49public override int Length
Text\StringText.cs (1)
47public override int Length => _source.Length;
Text\SubText.cs (1)
43public override int Length => UnderlyingSpan.Length;
Microsoft.CodeAnalysis.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequenceSourceText.cs (1)
27public override int Length => _virtualChars.Count;
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequenceSourceText.cs (1)
27public override int Length => _virtualChars.Count;
Microsoft.CodeAnalysis.CodeStyle (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequenceSourceText.cs (1)
27public override int Length => _virtualChars.Count;
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequenceSourceText.cs (1)
27public override int Length => _virtualChars.Count;
Microsoft.CodeAnalysis.Workspaces (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequenceSourceText.cs (1)
27public override int Length => _virtualChars.Count;
Roslyn.Diagnostics.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequenceSourceText.cs (1)
27public override int Length => _virtualChars.Count;
194 references to Length
dotnet-format (1)
Formatters\DocumentFormatter.cs (1)
168var changeMessage = changes.Count > 1 || change.NewText?.Length != formattedText.Length
GenerateDocumentationAndConfigFiles (4)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
29var fullSpan = new TextSpan(0, text.Length); 74if (index < text.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
24public readonly int Length(SourceText text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.AspNetCore.App.Analyzers (1)
Infrastructure\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
23public int Length(SourceText text) => text.Length;
Microsoft.CodeAnalysis (70)
DiagnosticAnalyzer\AdditionalTextComparer.cs (2)
45if (xText is null || yText is null || xText.Length != yText.Length)
EmbeddedText.cs (2)
303maxByteCount = text.Encoding.GetMaxByteCount(text.Length); 319using (var writer = new StreamWriter(builder, text.Encoding, bufferSize: Math.Max(1, text.Length), leaveOpen: true))
Syntax\SyntaxDiffer.cs (1)
82return new[] { new TextSpan(0, after!.GetText().Length) };
Syntax\SyntaxTreeExtensions.cs (2)
29var fullSpan = new TextSpan(0, text.Length); 74if (index < text.Length)
Text\ChangedText.cs (7)
40if (oldText.Length + deltaLength != newText.Length) 49if (change.Span.Start > oldText.Length) 52if (change.Span.End > oldText.Length) 114get { return _newText.Length; } 206return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), _newText.Length));
Text\CompositeText.cs (17)
44Debug.Assert(_segments[i].Length > 0); 45offset += _segments[i].Length; 100var copyLength = Math.Min(count, segment.Length - segOffset); 158var copyLength = Math.Min(count, segment.Length - segOffset); 211segments.RemoveAll(static (s, _, _) => s.Length == 0, arg: 0); 218if (prevSegment.Length > 0 && prevSegment[^1] == '\r' && curSegment[0] == '\n') 222segments[i - 1] = prevSegment.GetSubText(new TextSpan(0, prevSegment.Length - 1)); 224segments[i + 1] = curSegment.GetSubText(new TextSpan(1, curSegment.Length - 1)); 233segments.RemoveAll(static (s, _, _) => s.Length == 0, arg: 0); 293if (segments[i].Length <= segmentSize) 299if (segments[j].Length > segmentSize) 326if (segments[i].Length <= segmentSize) 328int combinedLength = segments[i].Length; 334if (segments[j].Length > segmentSize) 340combinedLength += segments[j].Length; 377length += segment.Length; 452Debug.Assert(segment.Length > 0);
Text\SourceText.cs (26)
409get { return this.Length; } 464/// greater than <see cref="Length"/>.</exception> 492if (span.End > this.Length) 510else if (spanLength == this.Length && span.Start == 0) 525if (start < 0 || start > this.Length) 536return this.GetSubText(new TextSpan(start, this.Length - start)); 545this.Write(textWriter, new TextSpan(0, this.Length), cancellationToken); 640for (int index = 0, length = this.Length; index < length; index += CharBufferSize) 714return ToString(new TextSpan(0, this.Length)); 729int position = Math.Max(Math.Min(span.Start, this.Length), 0); 730int length = Math.Min(span.End, this.Length) - position; 787if (change.Span.End > this.Length) 838if (position < this.Length) 840var subText = this.GetSubText(new TextSpan(position, this.Length - position)); 909return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), this.Length)); 1039return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, _text.Length), lineBreakLength: 0); 1053if (position < 0 || position > _text.Length) 1101var length = this.Length; 1119if (0 == this.Length) 1126var lineStarts = new SegmentedList<uint>(Length / 64) 1239if (this.Length != other.Length) 1251for (int position = 0, length = this.Length; position < length; position += CharBufferSize) 1253var count = Math.Min(this.Length - position, CharBufferSize); 1387public override int Length => _underlying.Length;
Text\SourceTextStream.cs (2)
114while (count >= _minimumTargetBufferCount && _position < _source.Length) 151int charsToRead = Math.Min(_charBuffer.Length, _source.Length - _sourceOffset);
Text\SubText.cs (3)
28|| span.End > text.Length) 93int compositeStart = Math.Min(UnderlyingText.Length, UnderlyingSpan.Start + start); 94int compositeEnd = Math.Min(UnderlyingText.Length, compositeStart + length);
Text\TextLine.cs (7)
52if (span.Start > text.Length || span.Start < 0 || span.End > text.Length) 57if (text.Length > 0) 71else if (span.End < text.Length) 82if (span.End < text.Length && lineBreakLen == 0) 101Debug.Assert(span.End == text.Length || TextUtilities.IsAnyLineBreakCharacter(text[span.End - 1])); 175if (_text == null || _text.Length == 0)
Text\TextUtilities.cs (1)
35return (next < text.Length) && '\n' == text[next] ? 2 : 1;
Microsoft.CodeAnalysis.Analyzers (5)
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (1)
434return unshippedText.Replace(new TextSpan(0, unshippedText.Length), builder.ToString());
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
29var fullSpan = new TextSpan(0, text.Length); 74if (index < text.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
24public readonly int Length(SourceText text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.AnalyzerUtilities (3)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
29var fullSpan = new TextSpan(0, text.Length); 74if (index < text.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
24public readonly int Length(SourceText text) => text.Length;
Microsoft.CodeAnalysis.CodeStyle (3)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
29var fullSpan = new TextSpan(0, text.Length); 74if (index < text.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
24public readonly int Length(SourceText text) => text.Length;
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.CSharp (8)
Parser\Lexer.cs (3)
719int end = TextWindow.Text.Length; 2072if ((position + s_conflictMarkerLength) <= text.Length) 2087return (position + s_conflictMarkerLength) < text.Length &&
Parser\SlidingTextWindow.cs (1)
108_textEnd = text.Length;
Parser\SyntaxParser.cs (1)
141var size = Math.Min(CachedTokenArraySize, this.lexer.TextWindow.Text.Length / 2);
Syntax\CSharpSyntaxTree.cs (2)
551return this.WithChanges(newText, new[] { new TextChangeRange(new TextSpan(0, this.Length), newText.Length) }); 565if (workingChanges.Count == 1 && workingChanges[0].Span == new TextSpan(0, this.Length) && workingChanges[0].NewLength == newText.Length)
Syntax\CSharpSyntaxTree.LazySyntaxTree.cs (1)
62get { return _text.Length; }
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
401|| document.Text.Lines.GetLinePosition(document.Text.Length).Character == 0)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
82while (end < text.Length && text[end] == ' ') 85if (end < text.Length && SyntaxFacts.IsNewLine(text[end]))
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
84while (end < text.Length && text[end] == ' ') 87if (end < text.Length && SyntaxFacts.IsNewLine(text[end]))
Microsoft.CodeAnalysis.CSharp.Features (10)
Completion\CompletionProviders\CompletionUtilities.cs (1)
137=> ch == ' ' && (characterPosition == text.Length - 1 || !IsWordStartCharacter(text[characterPosition + 1]));
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
238if (position >= syntaxTree.GetText(cancellationToken).Length)
RawStringLiteral\CSharpRawStringLiteralOnAutoInsertService.cs (3)
40if (position + 1 < text.Length && text[position + 1] == '"') 91while (end < text.Length && text[end] == '"') 139if (position < text.Length && text[position] == '"')
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
401|| document.Text.Lines.GetLinePosition(document.Text.Length).Character == 0)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
82while (end < text.Length && text[end] == ' ') 85if (end < text.Length && SyntaxFacts.IsNewLine(text[end]))
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
84while (end < text.Length && text[end] == ' ') 87if (end < text.Length && SyntaxFacts.IsNewLine(text[end]))
Microsoft.CodeAnalysis.ExternalAccess.HotReload (1)
Api\HotReloadMSBuildWorkspace.cs (1)
225if (!zeroLengthRetryPerformed && sourceText.Length == 0)
Microsoft.CodeAnalysis.Features (32)
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
137if (text.Length == 0 || !IsCommentStartCharacter(text[0]))
BraceMatching\AbstractBraceMatcher.cs (1)
68if (position < text.Length && this.IsBrace(text[position]))
BraceMatching\BraceMatchingService.cs (1)
27if (position < 0 || position > text.Length)
CodeFixes\Configuration\ConfigurationUpdater.cs (1)
768var textChange = new TextChange(new TextSpan(result.Length, 0), prefix + newEntry);
CodeFixes\Service\CodeFixService.cs (1)
295textSpan = new TextSpan(0, text.Length);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
715[new TextSpan(0, text.Length)],
Completion\CommonCompletionUtilities.cs (3)
51while (end < text.Length && isWordCharacter(text[end])) 76if (characterPosition < text.Length - 1 && 194if (characterPosition < 0 || characterPosition >= text.Length)
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
310if (text.Length > replacementSpan.End + 1
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
238if (targetSelectionSpan.Start > 0 && targetSelectionSpan.End <= text.Length)
Completion\Providers\CompletionUtilities.cs (1)
88while (end < text.Length && syntaxFacts.IsIdentifierPartCharacter(text[end]))
Copilot\ICopilotChangeAnalysisService.cs (4)
128OldDocumentLength: oldText.Length, 129NewDocumentLength: newText.Length, 130TextChangeDelta: newText.Length - oldText.Length,
Copilot\IProposalAdjusterService.cs (2)
207if (span.Start < originalText.Length && originalText[span.Start] == '\n') 218span.End < originalText.Length &&
Diagnostics\Service\DiagnosticAnalyzerService_GetDiagnosticsForSpan.cs (1)
56if (range == new TextSpan(0, text.Length))
Diagnostics\Service\DocumentAnalysisExecutor_Helpers.cs (1)
180if (location.SourceSpan.End > text.Length)
EditAndContinue\DocumentSemanticModel.cs (1)
29Debug.Assert(syntaxTree.GetText().Length == 0);
ExternalAccess\VSTypeScript\VSTypeScriptTaskListService.cs (1)
40var textSpan = new TextSpan(Math.Min(text.Length, Math.Max(0, d.Position)), 0);
NavigateTo\NavigateToUtilities.cs (4)
38spanStart = spanStart > sourceText.Length ? sourceText.Length : spanStart; 39spanEnd = spanEnd > sourceText.Length ? sourceText.Length : spanEnd;
Navigation\IDefinitionLocationService.cs (1)
85=> position >= 0 && position < text.Length ? text[position] : (char)0;
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (2)
181while (endExclusive < sourceText.Length && 203endExclusive + 1 < sourceText.Length && char.IsLetterOrDigit(sourceText[endExclusive + 1]))
SolutionCrawler\AbstractDocumentDifferenceService.cs (1)
54var incrementalParsingCandidate = range.NewLength != newText.Length;
src\roslyn\src\Compilers\Core\Portable\Text\TextUtilities.cs (1)
35return (next < text.Length) && '\n' == text[next] ? 2 : 1;
Wrapping\AbstractCodeActionComputer.cs (1)
91new TextChange(TextSpan.FromBounds(nodeOrToken.Span.End, OriginalSourceText.Length), newLine));
Microsoft.CodeAnalysis.Razor.Compiler (15)
Language\Legacy\SeekableTextReader.cs (3)
37public int Length => SourceText.Length; 74if (_position < SourceText.Length) 118if (SourceText.Length == 0)
Language\RazorHtmlWriter.cs (6)
54source.Text.Length == text.Length, 55$"The backing HTML document should be the same length as the original document. Expected: {source.Text.Length} Actual: {text.Length}"); 311Debug.Assert(nextIndex <= text.Length, "The next index should not exceed the length of the source text."); 313if (nextIndex >= text.Length || text[nextIndex] != '>')
Language\Syntax\SyntaxNodeExtensions.cs (6)
52if (source.Text.Length == 0) 57if (node.Position == source.Text.Length) 60var lastPosition = source.Text.Length - 1; 87if (source.Text.Length == 0) 92if (token.Position == source.Text.Length) 95var lastPosition = source.Text.Length - 1;
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
AbstractResxGenerator.cs (1)
937var remaining = _text.Length - _position;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
29var fullSpan = new TextSpan(0, text.Length); 74if (index < text.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
24public readonly int Length(SourceText text) => text.Length;
Microsoft.CodeAnalysis.VisualBasic (7)
CommandLine\CommandLineDiagnosticFormatter.vb (1)
39text.Length < diagnosticSpanOpt.Value.End Then
Scanner\Scanner.vb (3)
111_bufferLen = textToScan.Length 727If (position + s_conflictMarkerLength) <= text.Length Then 738Return (position + s_conflictMarkerLength) < text.Length AndAlso
Syntax\VisualBasicSyntaxTree.LazySyntaxTree.vb (1)
68Return _text.Length
Syntax\VisualBasicSyntaxTree.vb (2)
109Return Me.WithChanges(newText, {New TextChangeRange(New TextSpan(0, Me.Length), newText.Length)}) 121If changes.Length = 1 AndAlso changes(0).Span = New TextSpan(0, Me.Length) AndAlso changes(0).NewLength = newText.Length Then
Microsoft.CodeAnalysis.VisualBasic.Features (1)
DocumentationComments\VisualBasicDocumentationCommentSnippetService.vb (1)
245If position >= syntaxTree.GetText(cancellationToken).Length Then
Microsoft.CodeAnalysis.Workspaces (19)
CodeCleanup\CodeCleaner.cs (1)
53return await CleanupAsync(document, new TextSpan(0, text.Length), options, providers, cancellationToken: cancellationToken).ConfigureAwait(false);
Shared\Extensions\FileLinePositionSpanExtensions.cs (1)
89Contract.ThrowIfTrue(end > text.Lines.GetLinePosition(text.Length));
Shared\Extensions\SourceTextExtensions.cs (5)
81var length = text.Length - value.Length; 113startIndex = startIndex + normalized.Length > text.Length 114? text.Length - normalized.Length 148if (position + value.Length > text.Length) 180var length = sourceText.Length;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
29var fullSpan = new TextSpan(0, text.Length); 74if (index < text.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
24public readonly int Length(SourceText text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
TemporaryStorage\TemporaryStorageService.cs (1)
114var size = Encoding.Unicode.GetMaxByteCount(text.Length);
TemporaryStorage\TrivialTemporaryStorageService.cs (1)
69Identifier = new TemporaryStorageIdentifier(Guid.NewGuid().ToString(), 0, _sourceText.Length);
Workspace\Solution\Document.cs (1)
486if (textChanges.Length > 1 || (textChanges.Length == 1 && textChanges[0].Span != new TextSpan(0, oldText.Length)))
Workspace\Solution\DocumentState.cs (5)
270if (oldText.Length < MaxTextChangeRangeLength && newText.Length < MaxTextChangeRangeLength) 277if (change.NewLength == newText.Length) 677if (newTree.Length == newText.Length) 690FatalError.ReportAndCatch(new Exception($"tree and text has different length {newTree.Length} vs {newText.Length}"), ErrorSeverity.Critical);
Roslyn.Diagnostics.Analyzers (4)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
29var fullSpan = new TextSpan(0, text.Length); 74if (index < text.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
24public readonly int Length(SourceText text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))