3 instantiations of TextLine
Microsoft.CodeAnalysis (3)
Text\TextLine.cs (3)
77return new TextLine(text, span.Start, span.End); 81return new TextLine(text, 0, 0); 93return new TextLine(text, span.Start, span.End);
412 references to TextLine
CSharpSyntaxGenerator (1)
SourceGenerator.cs (1)
83var line = inputText.Lines[xmlException.LineNumber - 1]; // LineNumber is one-based.
GenerateDocumentationAndConfigFiles (4)
src\RoslynAnalyzers\Microsoft.CodeAnalysis.Analyzers\Core\MetaAnalyzers\ReleaseTrackingHelper.cs (4)
46Action<string, Version, string, SourceText, TextLine> onDuplicateEntryInRelease, 47Action<TextLine, InvalidEntryKind, string, SourceText> onInvalidEntry, 56foreach (TextLine line in sourceText.Lines) 253void OnInvalidEntry(TextLine line, InvalidEntryKind invalidEntryKind)
Microsoft.AspNetCore.App.Analyzers (2)
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (1)
217var currentLine = tokenSourceText.Lines[lineNumber];
Infrastructure\VirtualChars\TextLineExtensions.cs (1)
10public static int? GetFirstNonWhitespaceOffset(this TextLine line)
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
390foreach (var textLine in sourceText.Lines)
Microsoft.AspNetCore.Http.Microbenchmarks (1)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
390foreach (var textLine in sourceText.Lines)
Microsoft.CodeAnalysis (44)
CommandLine\AnalyzerConfig.cs (1)
207foreach (var textLine in text.Lines)
Syntax\LineDirectiveMap.cs (2)
208var endLine = lines[unmappedEndLine]; 217var lastLine = lines[^1];
Syntax\SyntaxTreeExtensions.cs (1)
72var line = text.Lines[position.Line];
Text\CompositeText.cs (4)
486public override TextLine this[int lineNumber] 502var firstSegmentTextLine = firstSegment.Lines[lineNumber - firstSegmentFirstLineNumber]; 530var resultLine = TextLine.FromSpanUnsafe(_compositeText, new TextSpan(firstSegmentOffset + firstSegmentTextLine.Start, lineLength));
Text\SourceText.cs (4)
976public override TextLine this[int index] 988return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, _text.Length)); 993return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, end)); 1037public override TextLine GetLineFromPosition(int position)
Text\SubText.cs (7)
113var startLineInUnderlyingText = _subText.UnderlyingText.Lines.GetLineFromPosition(_subText.UnderlyingSpan.Start); 114var endLineInUnderlyingText = _subText.UnderlyingText.Lines.GetLineFromPosition(_subText.UnderlyingSpan.End); 140public override TextLine this[int lineNumber] 154return TextLine.FromSpanUnsafe(_subText, new TextSpan(_subText.UnderlyingSpan.End, 0)); 157var underlyingTextLine = _subText.UnderlyingText.Lines[lineNumber + _startLineNumberInUnderlyingText]; 181var resultLine = TextLine.FromSpanUnsafe(_subText, new TextSpan(startInSubText, length));
Text\TextLine.cs (12)
14public readonly struct TextLine : IEquatable<TextLine> 28/// Creates a <see cref="TextLine"/> instance. 32/// <returns>An instance of <see cref="TextLine"/>.</returns> 34public static TextLine FromSpan(SourceText text, TextSpan span) 88internal static TextLine FromSpanUnsafe(SourceText text, TextSpan span) 183public static bool operator ==(TextLine left, TextLine right) 188public static bool operator !=(TextLine left, TextLine right) 193public bool Equals(TextLine other) 202if (obj is TextLine) 204return Equals((TextLine)obj);
Text\TextLineCollection.cs (13)
14/// Abstract base class for <see cref="TextLine"/> collections. 16public abstract class TextLineCollection : IReadOnlyList<TextLine> 19/// The count of <see cref="TextLine"/> items in the collection 24/// Gets the <see cref="TextLine"/> item at the specified index. 26public abstract TextLine this[int index] { get; } 34/// Gets a <see cref="TextLine"/> that encompasses the character position. 38public virtual TextLine GetLineFromPosition(int position) 48var line = GetLineFromPosition(position); 86IEnumerator<TextLine> IEnumerable<TextLine>.GetEnumerator() 97public struct Enumerator : IEnumerator<TextLine>, IEnumerator 108public TextLine Current 119return default(TextLine);
Microsoft.CodeAnalysis.Analyzers (10)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs (1)
242foreach (var line in lines)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ReleaseTracking.cs (3)
180using var reportedInvalidLines = PooledHashSet<TextLine>.GetInstance(); 188void OnDuplicateEntryInRelease(string ruleId, Version currentVersion, string path, SourceText sourceText, TextLine line) 208void OnInvalidEntry(TextLine line, InvalidEntryKind invalidEntryKind, string path, SourceText sourceText)
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (1)
263foreach (TextLine line in unshippedText.Lines)
MetaAnalyzers\ReleaseTrackingHelper.cs (4)
46Action<string, Version, string, SourceText, TextLine> onDuplicateEntryInRelease, 47Action<TextLine, InvalidEntryKind, string, SourceText> onInvalidEntry, 56foreach (TextLine line in sourceText.Lines) 253void OnInvalidEntry(TextLine line, InvalidEntryKind invalidEntryKind)
MetaAnalyzers\SymbolIsBannedInAnalyzersAnalyzer.cs (1)
96foreach (var line in source.Lines)
Microsoft.CodeAnalysis.CodeStyle (34)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
132var expressionFirstLine = lines.GetLineFromPosition(parenthesizedExpressionLocation.SourceSpan.Start);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
72var line = text.Lines[position.Line];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
49var activeSectionLines = ImmutableDictionary.CreateBuilder<string, TextLine>(AnalyzerConfigOptions.KeyComparer); 53var activeLine = default(TextLine); 54foreach (var textLine in text.Lines)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\IEditorConfigOptionAccumulator.cs (1)
14void ProcessSection(Section section, IReadOnlyDictionary<string, string> values, IReadOnlyDictionary<string, TextLine> lines);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOptionAccumulator.cs (1)
23public void ProcessSection(Section section, IReadOnlyDictionary<string, string> values, IReadOnlyDictionary<string, TextLine> lines)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
20var line = text.Lines.GetLineFromPosition(position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextLineExtensions.cs (8)
12public static int? GetLastNonWhitespacePosition(this TextLine line) 30public static int? GetFirstNonWhitespacePosition(this TextLine line) 44public static int? GetFirstNonWhitespaceOffset(this TextLine line) 59public static string GetLeadingWhitespace(this TextLine line) 65public static bool IsEmptyOrWhitespace(this TextLine line) 80public static int GetColumnOfFirstNonWhitespaceCharacterOrEndOfLine(this TextLine line, int tabSize) 83public static int GetColumnFromLineOffset(this TextLine line, int lineOffset, int tabSize) 86public static int GetLineOffsetFromColumn(this TextLine line, int column, int tabSize)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
166var textLine = baseToken.SyntaxTree.GetText(cancellationToken).Lines.GetLineFromPosition(baseToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (1)
27var line = _text.Lines.GetLineFromPosition(token.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.cs (1)
29TSyntaxRoot root, SourceText text, TextLine lineToBeIndented, IndentationOptions options, AbstractFormattingRule baseFormattingRule);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (7)
25public readonly TextLine LineToBeIndented; 46TextLine lineToBeIndented, 111var previousLine = this.Text.Lines[LineToBeIndented.LineNumber - 1]; 153var line = this.Text.Lines[currentLine]; 175var updatedLine = updatedSourceText.Lines[LineToBeIndented.LineNumber]; 211public IndentationResult GetIndentationOfLine(TextLine lineToMatch) 214public IndentationResult GetIndentationOfLine(TextLine lineToMatch, int addedSpaces)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (2)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines) 122=> lines.TryGetValue(Key, out var line) ? line.Span : null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingRule.cs (1)
47IReadOnlyDictionary<string, TextLine> lines,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingStyle.cs (1)
21IReadOnlyDictionary<string, TextLine> lines,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (1)
25IReadOnlyDictionary<string, TextLine> lines,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
86var line = syntaxTree.GetText(cancellationToken).Lines.GetLineFromPosition(spanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
151var line = tree.GetText().Lines.GetLineFromPosition(startPosition);
Microsoft.CodeAnalysis.CodeStyle.Fixes (34)
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (28)
77if (!ShouldFix(root, text, position, out var startLine, out var firstMiddleLine, out var secondMiddleLine, out var endLine)) 85out TextLine startLine, out TextLine firstMiddleLine, out TextLine secondMiddleLine, out TextLine endLine) 93var conflictLine = lines.GetLineFromPosition(position); 146out TextLine startLine, out TextLine firstMiddleLine, out TextLine secondMiddleLine, out TextLine endLine) 207private static bool TryFindLineForwards(TextLine startLine, char ch, out TextLine foundLine) 213var currentLine = lines[i]; 225private static bool TryFindLineBackwards(TextLine startLine, char ch, out TextLine foundLine) 231var currentLine = lines[i]; 243private static bool IsConflictMarker(TextLine currentLine, char ch) 265CodeFixContext context, TextLine startLine, TextLine firstMiddleLine, TextLine secondMiddleLine, TextLine endLine) 416if (!ShouldFix(root, text, position, out var startLine, out var firstMiddleLine, out var secondMiddleLine, out var endLine))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (2)
236var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 237var locationLine = sourceText.Lines.GetLineFromPosition(location);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\AbstractIndentationService.cs (1)
43var lineToBeIndented = document.Text.Lines[lineNumber];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (3)
31var tokenLine = document.Text.Lines.GetLineFromPosition(token.SpanStart); 55var newTokenLine = newDocument.Text.Lines.GetLineFromPosition(newRoot.GetAnnotatedTokens(annotation).Single().SpanStart); 68var baseLine = sourceText.Lines.GetLineFromPosition(indentationResult.BasePosition);
Microsoft.CodeAnalysis.CSharp (1)
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
1288var line = referencedLines[lineNumberZeroBased];
Microsoft.CodeAnalysis.CSharp.CodeStyle (4)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
131private static bool IsAllWhitespace(TextLine textLine)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (2)
73var colonLine = sourceText.Lines.GetLineFromPosition(colonToken.SpanStart); 74var thisBaseLine = sourceText.Lines.GetLineFromPosition(thisOrBaseKeyword.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
205var currentLine = tokenSourceText.Lines[lineNumber];
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
128TextChange? TryDedentLine(TextLine textLine) 179int ComputeCommonIndentationLength(TextLine textLine) 214SyntaxTree tree, SyntaxNode root, string indentation, TextLine textLine, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
45var line = sourceText.Lines.GetLineFromPosition(position);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (1)
49TextLine line,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (1)
26CompilationUnitSyntax root, SourceText text, TextLine lineToBeIndented,
Microsoft.CodeAnalysis.CSharp.EditorFeatures (9)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (3)
195var line = text.Lines.GetLineFromPosition(position); 255var line = text.Lines.GetLineFromPosition(position); 274private static bool LocatedAtTheEndOfLine(TextLine line, SyntaxToken lastToken)
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
249var lastLine = textBeforePaste.Lines.GetLineFromPosition(stringExpressionBeforePaste.Span.End);
StringCopyPaste\StringCopyPasteHelpers.cs (3)
23public static bool HasNewLine(TextLine line) 104public static int GetFirstNonWhitespaceIndex(SourceText text, TextLine line) 504foreach (var line in text.Lines)
StringCopyPaste\UnknownSourcePasteProcessor.cs (2)
185var currentChangeLine = textOfCurrentChange.Lines[i]; 254var currentChangeLine = textOfCurrentChange.Lines[lineIndex];
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (4)
Extensions\SyntaxTreeExtensionsTests.cs (2)
18var line = tree.GetText().Lines[lineNumber]; 27var line = tree.GetText().Lines[lineNumber];
StringIndentation\StringIndentationTests.cs (2)
47var firstLine = text.Lines.GetLineFromPosition(region.IndentSpan.Start); 48var lastLine = text.Lines.GetLineFromPosition(region.IndentSpan.End);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
PDB\CSharpPDBTestBase.cs (2)
40var startLine = text.Lines.GetLineFromPosition(span.Start); 44var endLine = text.Lines.GetLineFromPosition(span.End);
Microsoft.CodeAnalysis.CSharp.Features (29)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (2)
144var desiredCaretLine = GetLineBetweenCurlys(newClosingPoint, newDocument.Text); 163static TextLine GetLineBetweenCurlys(int closingPosition, SourceText text)
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (7)
304var line = text.Lines[i]; 358var interpolationLine = text.Lines.GetLineFromPosition(interpolation.SpanStart); 475var lineContainingPosition = text.Lines.GetLineFromPosition(position); 481private static void AppendFullLine(StringBuilder builder, TextLine line) 508var startLine = text.Lines.GetLineFromPosition(descendantSpan.Start); 537using var _3 = ArrayBuilder<TextLine>.GetInstance(out var lines); 638ArrayBuilder<TextLine> lines,
EditAndContinue\BreakpointSpans.cs (2)
24var line = source.Lines.GetLineFromPosition(position); 43private static bool IsBlank(TextLine line)
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (3)
70var firstLine = lines.GetLineFromPosition(token.Span.Start); 71var lastLine = lines.GetLineFromPosition(token.Span.End); 78var currentLine = lines[i];
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
85var line = sourceText.Lines.GetLineFromPosition(triviaSpan.Start);
Snippets\CSharpIntMainSnippetProvider.cs (1)
45var line = sourceText.Lines.GetLineFromPosition(triviaSpan.Start);
Snippets\CSharpSnippetHelpers.cs (1)
24var line = sourceText.Lines.GetLineFromPosition(triviaSpan.Start);
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
131private static bool IsAllWhitespace(TextLine textLine)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (2)
73var colonLine = sourceText.Lines.GetLineFromPosition(colonToken.SpanStart); 74var thisBaseLine = sourceText.Lines.GetLineFromPosition(thisOrBaseKeyword.SpanStart);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
128TextChange? TryDedentLine(TextLine textLine) 179int ComputeCommonIndentationLength(TextLine textLine) 214SyntaxTree tree, SyntaxNode root, string indentation, TextLine textLine, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
841var lineToConsider = text.Lines.GetLineFromPosition(expressionToReplace.SpanStart);
StringIndentation\CSharpStringIndentationService.cs (3)
147var line = text.Lines[i]; 162var lastLine = text.Lines.GetLineFromPosition(expression.Span.End); 171var firstLine = text.Lines.GetLineFromPosition(expression.SpanStart);
Structure\Providers\IfDirectiveTriviaStructureProvider.cs (2)
50var startLine = text.Lines[startLineNumber]; 51var endLine = text.Lines[endLineNumber];
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (3)
Diagnostics\LineSpanDirectiveTests.cs (1)
500var line = lines[position.Line];
IncrementalParsing\IncrementalParsingTests.cs (2)
623var openBraceLine = initialText.Lines[valueSetterLineIndex - 1]; 835var closeBraceLine = withOpenBraceDeletedLines[valueSetterLineIndex];
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
205var currentLine = tokenSourceText.Lines[lineNumber];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
45var line = sourceText.Lines.GetLineFromPosition(position);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (1)
49TextLine line,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (1)
26CompilationUnitSyntax root, SourceText text, TextLine lineToBeIndented,
Microsoft.CodeAnalysis.EditorFeatures (19)
DocumentationComments\AbstractDocumentationCommentCommandHandler.cs (1)
355private bool LineStartsWithExteriorTrivia(TextLine line)
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (17)
107TextLine? lastValidHeaderSpanEnd; 108TextLine? lastValidSpecificHeaderSpanEnd; 154private static (SourceText? newText, TextLine? lastValidHeaderSpanEnd, TextLine? lastValidSpecificHeaderSpanEnd) UpdateIfExistsInFile(SourceText editorConfigText, 164TextLine? mostRecentHeader = null; 165TextLine? lastValidHeader = null; 166TextLine? lastValidHeaderSpanEnd = null; 168TextLine? lastValidSpecificHeader = null; 169TextLine? lastValidSpecificHeaderSpanEnd = null; 172foreach (var curLine in editorConfigText.Lines) 236static bool IsValidHeader(TextLine? mostRecentHeader, TextLine? lastValidHeader) 291private static (SourceText? newText, TextLine? lastValidHeaderSpanEnd, TextLine? lastValidSpecificHeaderSpanEnd) AddMissingRule(SourceText editorConfigText, 292TextLine? lastValidHeaderSpanEnd, 293TextLine? lastValidSpecificHeaderSpanEnd, 323var lastLine = lines.Count > 0 ? lines[^1] : default;
Shared\Utilities\VirtualTreePoint.cs (1)
73public TextLine GetContainingLine()
Microsoft.CodeAnalysis.EditorFeatures.Text (4)
Extensions.cs (1)
36internal static TextLine AsTextLine(this ITextSnapshotLine line)
Extensions.SnapshotSourceText.cs (3)
151public override TextLine this[int index] 156return TextLine.FromSpan(_text, TextSpan.FromBounds(line.Start, line.End)); 163public override TextLine GetLineFromPosition(int position)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (7)
CodeFixes\CodeFixServiceTests.cs (1)
915var line = text.Lines[0];
EditorAdapter\TextSnapshotImplementationTest.cs (2)
42var line1 = text.Lines[0]; 53var line1 = text.Lines[1];
Extensions\ITextLineExtensionsTests.cs (3)
127private static TextLine GetLine(string codeLine) 135var line = GetLine(codeLine); 141var line = GetLine(codeLine);
MetadataAsSource\AbstractMetadataAsSourceTests.cs (1)
75var line = text.Lines.GetLineFromPosition(metadataAsSourceFile.IdentifierLocation.SourceSpan.Start);
Microsoft.CodeAnalysis.Features (67)
ClassifiedSpansAndHighlightSpanFactory.cs (1)
46var sourceLine = sourceText.Lines.GetLineFromPosition(referenceSpan.Start);
CodeFixes\Configuration\ConfigurationUpdater.cs (11)
416private (SourceText? newText, TextLine? lastValidHeaderSpanEnd, TextLine? lastValidSpecificHeaderSpanEnd) CheckIfRuleExistsAndReplaceInFile( 440TextLine? mostRecentHeader = null; 441TextLine? lastValidHeader = null; 442TextLine? lastValidHeaderSpanEnd = null; 444TextLine? lastValidSpecificHeader = null; 445TextLine? lastValidSpecificHeaderSpanEnd = null; 450foreach (var curLine in result.Lines) 676TextLine? lastValidHeaderSpanEnd, 677TextLine? lastValidSpecificHeaderSpanEnd) 741var lastLine = lines.Count > 0 ? lines[^1] : default;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (3)
109var line = lines[indexOfLine]; 126var line = lines[indexOfLine]; 274var lineAtPos = lines[indexOfLine];
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (2)
121TextLine line, 167var line = text.Lines.GetLineFromPosition(endToken.Value.Span.End);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (13)
56var line = text.Lines.GetLineFromPosition(commentStart); 121var line = text.Lines.GetLineFromPosition(documentationComment!.FullSpan.Start); 179var line = text.Lines.GetLineFromPosition(documentationComment.FullSpan.Start); 216var line = text.Lines.GetLineFromPosition(startPosition); 283var line = text.Lines.GetLineFromPosition(position); 287var previousLine = text.Lines[line.LineNumber - 1]; 317var currentLine = text.Lines.GetLineFromPosition(position); 340var line = text.Lines.GetLineFromPosition(startPosition); 391var currentLine = text.Lines.GetLineFromPosition(position); 398var previousLine = text.Lines[currentLine.LineNumber - 1]; 431public DocumentationCommentSnippet GetDocumentationCommentSnippetFromPreviousLine(in DocumentationCommentOptions options, TextLine currentLine, TextLine previousLine) 443private string CreateInsertionTextFromPreviousLine(TextLine previousLine, in DocumentationCommentOptions options)
DocumentationComments\IDocumentationCommentSnippetService.cs (2)
39TextLine currentLine, 40TextLine previousLine);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (1)
727var line = text.Lines.GetLineFromPosition(diagnostic.Span.Start);
QuickInfo\IndentationHelper.cs (2)
53var line = lines[lineNumber]; 117var line = lines[lineNumber];
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
132var expressionFirstLine = lines.GetLineFromPosition(parenthesizedExpressionLocation.SourceSpan.Start);
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (28)
77if (!ShouldFix(root, text, position, out var startLine, out var firstMiddleLine, out var secondMiddleLine, out var endLine)) 85out TextLine startLine, out TextLine firstMiddleLine, out TextLine secondMiddleLine, out TextLine endLine) 93var conflictLine = lines.GetLineFromPosition(position); 146out TextLine startLine, out TextLine firstMiddleLine, out TextLine secondMiddleLine, out TextLine endLine) 207private static bool TryFindLineForwards(TextLine startLine, char ch, out TextLine foundLine) 213var currentLine = lines[i]; 225private static bool TryFindLineBackwards(TextLine startLine, char ch, out TextLine foundLine) 231var currentLine = lines[i]; 243private static bool IsConflictMarker(TextLine currentLine, char ch) 265CodeFixContext context, TextLine startLine, TextLine firstMiddleLine, TextLine secondMiddleLine, TextLine endLine) 416if (!ShouldFix(root, text, position, out var startLine, out var firstMiddleLine, out var secondMiddleLine, out var endLine))
TaskList\AbstractTaskListService.cs (3)
131var startLine = text.Lines.GetLineFromPosition(fullSpan.Start); 132var endLine = text.Lines.GetLineFromPosition(fullSpan.End); 148var line = text.Lines[lineNumber];
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Handler\OnAutoInsert\OnAutoInsertHandler.cs (2)
185var caretLineInIndentedText = indentedText.Lines[desiredCaretLinePosition.Line]; 211TextLine lineToIndent,
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
176var line = text.Lines[startLine + currentLine];
Microsoft.CodeAnalysis.PublicApiAnalyzers (1)
DeclarePublicApiAnalyzer.cs (1)
168foreach (var line in sourceText.Lines)
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (3)
DeclarePublicApiFix.cs (1)
176foreach (TextLine textLine in sourceText.Lines)
PublicApiFixHelpers.cs (2)
74var lastLine = sourceText.Lines[^1]; 82var firstLine = sourceText.Lines[0];
Microsoft.CodeAnalysis.UnitTests (33)
Text\LargeTextTests.cs (5)
135private static void CheckEqualLine(TextLine first, TextLine second) 145private static void CheckNotEqualLine(TextLine first, TextLine second) 157var textLine = text.Lines[lineNumber];
Text\StringText_LineTest.cs (19)
21var line = TextLine.FromSpan(text, span); 32var line = TextLine.FromSpan(text, span); 43var line = TextLine.FromSpan(text, span); 53var line = TextLine.FromSpan(text, new TextSpan(0, 3)); 62Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 0))); 69Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 3))); 76Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 5))); 84var line = TextLine.FromSpan(text, new TextSpan(start, 0)); 98var line = TextLine.FromSpan(text, new TextSpan(0, 0)); 107Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 10))); 114Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(-1, 2))); 121Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(7, 0))); 128Assert.Throws<ArgumentNullException>(() => TextLine.FromSpan(null, new TextSpan(0, 2)));
Text\StringTextTest.cs (5)
88private void CheckEqualLine(TextLine first, TextLine second) 98private void CheckNotEqualLine(TextLine first, TextLine second) 110var textLine = text.Lines[lineNumber];
Text\TextChangeTests.cs (4)
255private sealed class TextLineEqualityComparer : IEqualityComparer<TextLine> 257public bool Equals(TextLine x, TextLine y) 262public int GetHashCode(TextLine obj)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.Indenter.vb (3)
43lineToBeIndented As TextLine, 318Private Shared Function GetIndentationFromTwoLines(indenter As Indenter, firstLine As TextLine, secondLine As TextLine, token As SyntaxToken, position As Integer) As IndentationResult
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.vb (1)
42line As TextLine,
Microsoft.CodeAnalysis.VisualBasic.Features (1)
EditAndContinue\BreakpointSpans.vb (1)
34Private Function IsBlank(line As TextLine) As Boolean
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.Indenter.vb (3)
43lineToBeIndented As TextLine, 318Private Shared Function GetIndentationFromTwoLines(indenter As Indenter, firstLine As TextLine, secondLine As TextLine, token As SyntaxToken, position As Integer) As IndentationResult
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.vb (1)
42line As TextLine,
Microsoft.CodeAnalysis.Workspaces (42)
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (2)
38var currentPartitionEndLine = originalSourceText.Lines.GetLineFromPosition(changes.First().Span.End); 43var changeStartLine = originalSourceText.Lines.GetLineFromPosition(change.Span.Start);
Shared\Extensions\SourceTextExtensions.cs (1)
37var line = text.Lines.GetLineFromPosition(position);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
72var line = text.Lines[position.Line];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
49var activeSectionLines = ImmutableDictionary.CreateBuilder<string, TextLine>(AnalyzerConfigOptions.KeyComparer); 53var activeLine = default(TextLine); 54foreach (var textLine in text.Lines)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\IEditorConfigOptionAccumulator.cs (1)
14void ProcessSection(Section section, IReadOnlyDictionary<string, string> values, IReadOnlyDictionary<string, TextLine> lines);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOptionAccumulator.cs (1)
23public void ProcessSection(Section section, IReadOnlyDictionary<string, string> values, IReadOnlyDictionary<string, TextLine> lines)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
20var line = text.Lines.GetLineFromPosition(position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextLineExtensions.cs (8)
12public static int? GetLastNonWhitespacePosition(this TextLine line) 30public static int? GetFirstNonWhitespacePosition(this TextLine line) 44public static int? GetFirstNonWhitespaceOffset(this TextLine line) 59public static string GetLeadingWhitespace(this TextLine line) 65public static bool IsEmptyOrWhitespace(this TextLine line) 80public static int GetColumnOfFirstNonWhitespaceCharacterOrEndOfLine(this TextLine line, int tabSize) 83public static int GetColumnFromLineOffset(this TextLine line, int lineOffset, int tabSize) 86public static int GetLineOffsetFromColumn(this TextLine line, int column, int tabSize)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
166var textLine = baseToken.SyntaxTree.GetText(cancellationToken).Lines.GetLineFromPosition(baseToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (1)
27var line = _text.Lines.GetLineFromPosition(token.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.cs (1)
29TSyntaxRoot root, SourceText text, TextLine lineToBeIndented, IndentationOptions options, AbstractFormattingRule baseFormattingRule);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (7)
25public readonly TextLine LineToBeIndented; 46TextLine lineToBeIndented, 111var previousLine = this.Text.Lines[LineToBeIndented.LineNumber - 1]; 153var line = this.Text.Lines[currentLine]; 175var updatedLine = updatedSourceText.Lines[LineToBeIndented.LineNumber]; 211public IndentationResult GetIndentationOfLine(TextLine lineToMatch) 214public IndentationResult GetIndentationOfLine(TextLine lineToMatch, int addedSpaces)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (2)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines) 122=> lines.TryGetValue(Key, out var line) ? line.Span : null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingRule.cs (1)
47IReadOnlyDictionary<string, TextLine> lines,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingStyle.cs (1)
21IReadOnlyDictionary<string, TextLine> lines,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (1)
25IReadOnlyDictionary<string, TextLine> lines,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
86var line = syntaxTree.GetText(cancellationToken).Lines.GetLineFromPosition(spanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
151var line = tree.GetText().Lines.GetLineFromPosition(startPosition);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (2)
236var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 237var locationLine = sourceText.Lines.GetLineFromPosition(location);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\AbstractIndentationService.cs (1)
43var lineToBeIndented = document.Text.Lines[lineNumber];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (3)
31var tokenLine = document.Text.Lines.GetLineFromPosition(token.SpanStart); 55var newTokenLine = newDocument.Text.Lines.GetLineFromPosition(newRoot.GetAnnotatedTokens(annotation).Single().SpanStart); 68var baseLine = sourceText.Lines.GetLineFromPosition(indentationResult.BasePosition);
Microsoft.DotNet.CodeAnalysis (3)
Analyzers\BaseAnalyzer.cs (1)
27foreach (var line in configFile.GetText().Lines)
Analyzers\MembersMustExistAnalyzer.cs (1)
72foreach (TextLine line in fileContents.Lines)
Analyzers\PinvokeAnalyzer.cs (1)
77foreach (TextLine line in fileContents.Lines)
Microsoft.VisualStudio.LanguageServices (13)
Extensions\DocumentExtensions.cs (2)
29foreach (var line in text.Lines) 51var previousLine = text.Lines[line.LineNumber - 1];
Extensions\VirtualTreePointExtensions.cs (1)
14var line = virtualSnapshotPoint.GetContainingLine();
FindReferences\Entries\AbstractDocumentSpanEntry.cs (1)
104var line = text.Lines.GetLineFromPosition(position);
Implementation\AbstractEditorFactory.cs (2)
355foreach (var originalLine in originalText.Lines) 362var currentLine = formattedText.Lines[originalLine.LineNumber];
Venus\ContainedDocument.cs (6)
508var visibleFirstLineInOriginalText = originalText.Lines.GetLineFromPosition(visibleSpanInOriginalText.Start); 509var visibleLastLineInOriginalText = originalText.Lines.GetLineFromPosition(visibleSpanInOriginalText.End); 890var startingLine = text.Lines.GetLineFromPosition(span.Start); 891for (var line = startingLine; line.Start < span.End; line = text.Lines[line.LineNumber + 1]) 936var firstLine = text.Lines.GetLineFromPosition(visibleSpan.Start); 937var lastLine = text.Lines.GetLineFromPosition(visibleSpan.End);
Workspace\VisualStudioFormattingRuleFactoryServiceFactory.cs (1)
68var line = text.Lines.GetLineFromPosition(position);
Microsoft.VisualStudio.LanguageServices.CSharp (9)
CodeModel\CSharpCodeModelService.NodeLocator.cs (9)
139var openBraceLine = text.Lines.GetLineFromPosition(openBrace.Span.End); 153var openBraceLine = text.Lines.GetLineFromPosition(openBrace.SpanStart); 154var closeBraceLine = text.Lines.GetLineFromPosition(closeBrace.SpanStart); 176var lineAfterOpenBrace = text.Lines[openBraceLine.LineNumber + 1]; 213var closeBraceLine = text.Lines.GetLineFromPosition(closeBrace.SpanStart); 385var line = text.Lines.GetLineFromPosition(node.SpanStart); 472var line = text.Lines.GetLineFromPosition(firstAccessorNode.SpanStart); 492var line = text.Lines.GetLineFromPosition(node.SpanStart); 531var line = text.Lines.GetLineFromPosition(node.SpanStart);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
CodeModel\MockTextManagerAdapter.TextPoint.cs (1)
105var line = _point.GetContainingLine();
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
CodeModel\VisualBasicCodeModelService.NodeLocator.vb (2)
338Dim nextStatementLine As Nullable(Of TextLine) = If(nextStatement IsNot Nothing, text.Lines.GetLineFromPosition(nextStatement.SpanStart), Nothing) 409Dim nextStatementLine As Nullable(Of TextLine) = If(nextStatement IsNot Nothing, text.Lines.GetLineFromPosition(nextStatement.SpanStart), Nothing)
Roslyn.Diagnostics.Analyzers (3)
src\RoslynAnalyzers\Utilities\Refactoring\AbstractRefactoringHelpers`3.cs (2)
209var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 210var locationLine = sourceText.Lines.GetLineFromPosition(location);
src\RoslynAnalyzers\Utilities\Refactoring\Extensions\TextLineExtensions.cs (1)
14public static bool IsEmptyOrWhitespace(this TextLine line)