1180 references to Lines
GenerateDocumentationAndConfigFiles (29)
IdeCoreBenchmarks (1)
Metrics (24)
Metrics.Legacy (24)
Microsoft.AspNetCore.App.Analyzers (4)
Microsoft.AspNetCore.Http.Microbenchmarks (3)
Microsoft.CodeAnalysis (23)
Microsoft.CodeAnalysis.Analyzers (38)
Microsoft.CodeAnalysis.AnalyzerUtilities (24)
Microsoft.CodeAnalysis.BannedApiAnalyzers (30)
Microsoft.CodeAnalysis.CodeStyle (25)
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
Microsoft.CodeAnalysis.CSharp (7)
Microsoft.CodeAnalysis.CSharp.CodeStyle (12)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
110var lines = text.Lines;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (31)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (32)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (8)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Features (81)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
110var lines = text.Lines;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (8)
Microsoft.CodeAnalysis.CSharp.Workspaces (23)
Microsoft.CodeAnalysis.EditorFeatures (13)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (9)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (1)
Microsoft.CodeAnalysis.ExternalAccess.Xaml (1)
Microsoft.CodeAnalysis.Features (70)
Microsoft.CodeAnalysis.Features.Test.Utilities (5)
Microsoft.CodeAnalysis.Features.UnitTests (17)
Microsoft.CodeAnalysis.LanguageServer (1)
Microsoft.CodeAnalysis.LanguageServer.Protocol (25)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (10)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (28)
Microsoft.CodeAnalysis.PublicApiAnalyzers (26)
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (4)
Microsoft.CodeAnalysis.Razor.Compiler (31)
Microsoft.CodeAnalysis.Razor.Workspaces (106)
Formatting\FormattingUtilities.cs (33)
143foreach (var line in sourceText.Lines)
243for (var iOriginal = 0; iOriginal < originalText.Lines.Count; iOriginal++, iFormatted++)
276if (iFormatted >= formattedText.Lines.Count)
283var formattedLine = formattedText.Lines[iFormatted];
286var originalLine = originalText.Lines[iOriginal];
319iFormatted + 1 < formattedText.Lines.Count)
322formattedLine = formattedText.Lines[iFormatted];
339formattedText.Lines[initialFormattedLine].EndIncludingLineBreak)));
343replacementBuilder.Append(GetAdjustedFormattedLineText(context, formattedText.Lines[wrappedLineIndex], fixedIndentationWidth, formattedText.Lines[wrappedLineIndex].EndIncludingLineBreak));
346replacementBuilder.Append(GetAdjustedFormattedLineText(context, formattedText.Lines[iFormatted], fixedIndentationWidth, formattedEnd));
372if (iFormatted + 1 < formattedText.Lines.Count &&
373formattedText.Lines[iFormatted + 1].Span.Length == 0 &&
374iOriginal + 1 < originalText.Lines.Count &&
375originalText.Lines[iOriginal + 1] is { } nextOriginalLine &&
429var originalLine = originalText.Lines[iOriginal];
495Debug.Assert(iFormatted < formattedText.Lines.Count);
497if (iOriginal == 0 || iFormatted >= formattedText.Lines.Count)
505var originalLine = originalText.Lines[previousOriginalLineIndex];
506var formattedLine = formattedText.Lines[iFormatted];
527=> lineNumber + 1 < text.Lines.Count &&
532lineNumber < text.Lines.Count &&
533text.Lines[lineNumber] is { Span.Length: > 0 } line &&
540if (lineNumber < 0 || lineNumber >= text.Lines.Count)
545var line = text.Lines[lineNumber];
604? TryAdvanceLine(context, logger, "formatted", formattedText, ref iFormatted, ref formattedLine, iOriginal, originalText.Lines.Count)
605: TryAdvanceLine(context, logger, "original", originalText, ref iOriginal, ref originalLine, iFormatted, formattedText.Lines.Count);
623? TryAdvanceLine(context, logger, "original", originalText, ref iOriginal, ref originalLine, iFormatted, formattedText.Lines.Count)
624: TryAdvanceLine(context, logger, "formatted", formattedText, ref iFormatted, ref formattedLine, iOriginal, originalText.Lines.Count);
663formattingChanges.Add(new TextChange(TextSpan.FromBounds(originalText.Lines[iOriginal - 1].End, originalLine.End), ""));
689if (lineIndex >= text.Lines.Count)
691context.Logger?.LogMessage($"Ran out of {label} lines at index {lineIndex} of {text.Lines.Count} (other side: {otherLineIndex} of {otherLineCount})");
696line = text.Lines[lineIndex];
Microsoft.CodeAnalysis.Razor.Workspaces.UnitTests (3)
Formatting\FormattingUtilitiesTest.cs (3)
26var actual = FormattingUtilities.GetIndentationLevel(text.Lines[0], text.Length, insertSpaces: true, tabSize, out var additionalIndentation);
45var actual = FormattingUtilities.GetIndentationLevel(text.Lines[0], text.Length, insertSpaces: false, tabSize: 4, out var additionalIndentation);
98Assert.Equal(10, FormattingUtilities.CountNonWhitespaceChars(text, 0, text.Lines[^1].End));
Microsoft.CodeAnalysis.ResxSourceGenerator (24)
Microsoft.CodeAnalysis.Test.Utilities (6)
Microsoft.CodeAnalysis.UnitTests (132)
Text\LargeTextTests.cs (27)
157var textLine = text.Lines[lineNumber];
170CheckEqualLine(textLine, text.Lines[lineNumber]);
173CheckEqualLine(textLine, text.Lines.GetLineFromPosition(p));
174Assert.Equal(lineNumber, text.Lines.IndexOf(p));
175Assert.Equal(lineNumber, text.Lines.GetLinePosition(p).Line);
176Assert.Equal(p - start, text.Lines.GetLinePosition(p).Character);
181CheckNotEqualLine(textLine, text.Lines.GetLineFromPosition(start - 1));
182Assert.Equal(lineNumber - 1, text.Lines.IndexOf(start - 1));
183Assert.Equal(lineNumber - 1, text.Lines.GetLinePosition(start - 1).Line);
189CheckNotEqualLine(textLine, text.Lines.GetLineFromPosition(nextPosition));
190Assert.Equal(lineNumber + 1, text.Lines.IndexOf(nextPosition));
191Assert.Equal(lineNumber + 1, text.Lines.GetLinePosition(nextPosition).Line);
200Assert.Equal(2, data.Lines.Count);
213Assert.Equal(3, data.Lines.Count);
224Assert.Equal(2, data.Lines.Count);
233Assert.Equal(4, data.Lines.Count);
245Assert.Equal(2, data.Lines.Count);
255Assert.Equal(2, data.Lines.Count);
265Assert.Equal(3, data.Lines.Count);
278Assert.Equal(4, data.Lines.Count);
293Assert.Equal(4, data.Lines.Count);
304Assert.Equal(1, data.Lines.Count);
315Assert.Equal(2, data.Lines.Count);
316Assert.Equal("goo", data.Lines[0].ToString());
317Assert.Equal("bar baz", data.Lines[1].ToString());
325Assert.Equal("goo", data.Lines[0].ToString());
337Assert.Equal("goo", actualSourceText.Lines[0].ToString());
Text\StringTextTest.cs (25)
47Assert.Equal(1, data.Lines.Count);
48Assert.Equal(3, data.Lines[0].Span.Length);
62Assert.Equal(1, data.Lines.Count);
63Assert.Equal(0, data.Lines[0].Span.Length);
110var textLine = text.Lines[lineNumber];
123CheckEqualLine(textLine, text.Lines[lineNumber]);
126CheckEqualLine(textLine, text.Lines.GetLineFromPosition(p));
127Assert.Equal(lineNumber, text.Lines.IndexOf(p));
128Assert.Equal(lineNumber, text.Lines.GetLinePosition(p).Line);
129Assert.Equal(p - start, text.Lines.GetLinePosition(p).Character);
134CheckNotEqualLine(textLine, text.Lines.GetLineFromPosition(start - 1));
135Assert.Equal(lineNumber - 1, text.Lines.IndexOf(start - 1));
136Assert.Equal(lineNumber - 1, text.Lines.GetLinePosition(start - 1).Line);
142CheckNotEqualLine(textLine, text.Lines.GetLineFromPosition(nextPosition));
143Assert.Equal(lineNumber + 1, text.Lines.IndexOf(nextPosition));
144Assert.Equal(lineNumber + 1, text.Lines.GetLinePosition(nextPosition).Line);
153Assert.Equal(2, data.Lines.Count);
166Assert.Equal(3, data.Lines.Count);
177Assert.Equal(2, data.Lines.Count);
186Assert.Equal(4, data.Lines.Count);
197Assert.Equal(1, data.Lines.Count);
208Assert.Equal(2, data.Lines.Count);
209Assert.Equal("goo", data.Lines[0].ToString());
210Assert.Equal("bar baz", data.Lines[1].ToString());
218Assert.Equal("goo", data.Lines[0].ToString());
Text\StringTextTests_Default.cs (17)
42Assert.Equal(1, data.Lines.Count);
43Assert.Equal(0, data.Lines[0].Span.Length);
59Assert.Equal(2, data.Lines.Count);
60Assert.Equal(3, data.Lines[0].Span.Length);
61Assert.Equal(3 + newLine.Length, data.Lines[1].Span.Start);
72Assert.Equal(3, data.Lines.Count);
73Assert.Equal("goo", data.ToString(data.Lines[0].Span));
74Assert.Equal("bar", data.ToString(data.Lines[1].Span));
75Assert.Equal("baz", data.ToString(data.Lines[2].Span));
82Assert.Equal(2, data.Lines.Count);
83Assert.Equal("goo", data.ToString(data.Lines[0].Span));
84Assert.Equal("bar", data.ToString(data.Lines[1].Span));
91Assert.Equal(3, data.Lines.Count);
100Assert.Equal(2, data.Lines.Count);
101Assert.Equal("goo", data.Lines[0].ToString());
102Assert.Equal("bar baz", data.Lines[1].ToString());
109Assert.Equal("goo", data.Lines[0].ToString());
Text\TextLineNewLineTests.cs (39)
214var line = text.Lines[lineNumber];
231Assert.Equal(reference.Lines.Count, actual.Lines.Count);
233for (var i = 0; i < reference.Lines.Count; i++)
235var referenceLine = reference.Lines[i];
236var actualLine = actual.Lines[i];
246Assert.Equal(reference.Lines.IndexOf(pos), actual.Lines.IndexOf(pos));
262Assert.Equal(2, text.Lines.Count);
271Assert.Equal(2, text.Lines.Count);
280Assert.Equal(2, text.Lines.Count);
289Assert.Equal(2, text.Lines.Count);
298Assert.Equal(3, text.Lines.Count);
308Assert.Equal(4, text.Lines.Count);
318Assert.Equal(3, text.Lines.Count);
328Assert.Equal(1, text.Lines.Count);
336Assert.Equal(1, text.Lines.Count);
344Assert.Equal(3, text.Lines.Count);
354Assert.Equal(3, text.Lines.Count);
364Assert.Equal(7, text.Lines.Count);
378Assert.Equal(3, text.Lines.Count);
388Assert.Equal(3, text.Lines.Count);
398Assert.Equal(3, text.Lines.Count);
459Assert.Equal(2, text.Lines.Count);
519Assert.Equal(2, subText.Lines.Count);
661var line0a = text.Lines[0];
662var line0b = text.Lines[0];
673var line0 = text.Lines[0];
674var line1 = text.Lines[1];
688var lineLF = textLF.Lines[0];
689var lineCRLF = textCRLF.Lines[0];
702var line1 = text1.Lines[0];
703var line2 = text2.Lines[0];
714var line = text.Lines[0];
715Assert.True(line.Equals((object)text.Lines[0]));
716Assert.False(line.Equals((object)text.Lines[1]));
725for (var i = 0; i < text.Lines.Count; i++)
727var lineA = text.Lines[i];
728var lineB = text.Lines[i];
Microsoft.CodeAnalysis.VisualBasic (11)
Microsoft.CodeAnalysis.Workspaces (45)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Microsoft.CodeAnalysis.Workspaces.UnitTests (4)
Microsoft.DotNet.CodeAnalysis (3)
Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests (2)
Microsoft.VisualStudio.LanguageServices (27)
Microsoft.VisualStudio.LanguageServices.CSharp (12)
Microsoft.VisualStudio.LanguageServices.Implementation (2)
Microsoft.VisualStudio.LanguageServices.Razor.UnitTests (7)
Microsoft.VisualStudioCode.RazorExtension.UnitTests (6)
Roslyn.Diagnostics.Analyzers (28)
Roslyn.Diagnostics.CSharp.Analyzers (23)
Test.Utilities (24)
Text.Analyzers (28)