22 overrides of Length
GenerateDocumentationAndConfigFiles (1)
Metrics (1)
Metrics.Legacy (1)
Microsoft.CodeAnalysis (6)
Microsoft.CodeAnalysis.Analyzers (1)
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
Microsoft.CodeAnalysis.BannedApiAnalyzers (1)
Microsoft.CodeAnalysis.CodeStyle (1)
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (1)
Microsoft.CodeAnalysis.PublicApiAnalyzers (1)
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
Microsoft.CodeAnalysis.Test.Utilities (1)
Microsoft.CodeAnalysis.Workspaces (1)
Roslyn.Diagnostics.Analyzers (1)
Test.Utilities (1)
Text.Analyzers (1)
304 references to Length
GenerateDocumentationAndConfigFiles (4)
IdeCoreBenchmarks (1)
Metrics (3)
Metrics.Legacy (3)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.CodeAnalysis (70)
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 (25)
407get { return this.Length; }
462/// greater than <see cref="Length"/>.</exception>
490if (span.End > this.Length)
508else if (spanLength == this.Length && span.Start == 0)
523if (start < 0 || start > this.Length)
534return this.GetSubText(new TextSpan(start, this.Length - start));
543this.Write(textWriter, new TextSpan(0, this.Length), cancellationToken);
638for (int index = 0, length = this.Length; index < length; index += CharBufferSize)
712return ToString(new TextSpan(0, this.Length));
727int position = Math.Max(Math.Min(span.Start, this.Length), 0);
728int length = Math.Min(span.End, this.Length) - position;
791if (change.Span.End > this.Length)
842if (position < this.Length)
844var subText = this.GetSubText(new TextSpan(position, this.Length - position));
913return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), this.Length));
1011return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, _text.Length));
1023if (position < 0 || position > _text.Length)
1071var length = this.Length;
1089if (0 == this.Length)
1096var lineStarts = new SegmentedList<int>(Length / 64)
1203if (this.Length != other.Length)
1215for (int position = 0, length = this.Length; position < length; position += CharBufferSize)
1217var count = Math.Min(this.Length - position, CharBufferSize);
Microsoft.CodeAnalysis.Analyzers (5)
Microsoft.CodeAnalysis.AnalyzerUtilities (3)
Microsoft.CodeAnalysis.BannedApiAnalyzers (4)
Microsoft.CodeAnalysis.CodeStyle (3)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp (8)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (6)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (6)
55await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length));
83await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
119return await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length));
165await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, sourceDocument, new TextSpan(0, sourceDocument.GetTextAsync().Result.Length));
195var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
251var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
Microsoft.CodeAnalysis.CSharp.Features (10)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (8)
Microsoft.CodeAnalysis.EditorFeatures (7)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
Microsoft.CodeAnalysis.EditorFeatures.Text (2)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.Features (29)
Microsoft.CodeAnalysis.LanguageServer.Protocol (4)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (8)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (4)
Microsoft.CodeAnalysis.PublicApiAnalyzers (3)
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (6)
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
Microsoft.CodeAnalysis.Test.Utilities (1)
Microsoft.CodeAnalysis.UnitTests (43)
Text\TextChangeTests.cs (27)
69Assert.Equal(0, subSubText.Length);
78var subSubText = subText.GetSubText(subText.Length);
81Assert.Equal(0, subSubText.Length);
247Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(newText.Length - 1, destination, 0, 2));
383Assert.Equal(str.Length + n, text.Length);
403Assert.Equal(str.Length, text.Length);
412Assert.Equal(26, text.Length);
416Assert.Equal(10, subtext.Length);
428Assert.Equal(6, newText.Length);
439Assert.Equal(20, newText.Length);
451Assert.Equal(25, newText.Length);
467Assert.Equal(27, textWithSegments.Length);
483Assert.Equal(27, textWithSegments.Length);
488Assert.Equal(24, textWithFewerSegments.Length);
502var textWithSegments = text.Replace(new TextSpan(0, text.Length), "");
503Assert.Equal(0, textWithSegments.Length);
514t = t.Replace(t.Length, 0, b); // add b's
525t = t.Replace(t.Length, 0, "c");
533Assert.Equal(new string('c', t.Segments[2].Length), t.Segments[2].ToString());
544t = t.Replace(t.Length, 0, b); // add b's
555t = t.Replace(t.Length, 0, c); // add c's that are the same segment size as the a's and b's
648Assert.Equal(text.Length + largeText.Length, newText.Length);
992var editedLength = originalText.Length;
996var oldMaxInsertLength = originalText.Length * 2;
999for (int i = 0; i < originalText.Length; i += random.Next(maxSkipLength))
1002var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText);
Microsoft.CodeAnalysis.VisualBasic (7)
Microsoft.CodeAnalysis.Workspaces (19)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
Microsoft.VisualStudio.LanguageServices (3)
Microsoft.VisualStudio.LanguageServices.CSharp (1)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
Roslyn.Diagnostics.Analyzers (4)
Test.Utilities (3)
Text.Analyzers (4)