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);
388 references to TextLine
CSharpSyntaxGenerator (1)
SourceGenerator.cs (1)
83var line = inputText.Lines[xmlException.LineNumber - 1]; // LineNumber is one-based.
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.CodeStyle (33)
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)
48var activeSectionProperties = ImmutableDictionary.CreateBuilder<string, (string value, TextLine? line)>(AnalyzerConfigOptions.KeyComparer); 52var activeLine = default(TextLine); 53foreach (var textLine in text.Lines)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\IEditorConfigOptionAccumulator.cs (1)
15void ProcessSection(Section section, IReadOnlyDictionary<string, (string value, TextLine? line)> properties);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOptionAccumulator.cs (1)
25public void ProcessSection(Section section, IReadOnlyDictionary<string, (string value, TextLine? line)> properties)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
21var 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)
28var 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)
26public readonly TextLine LineToBeIndented; 47TextLine lineToBeIndented, 112var previousLine = this.Text.Lines[LineToBeIndented.LineNumber - 1]; 154var line = this.Text.Lines[currentLine]; 176var updatedLine = updatedSourceText.Lines[LineToBeIndented.LineNumber]; 212public IndentationResult GetIndentationOfLine(TextLine lineToMatch) 215public IndentationResult GetIndentationOfLine(TextLine lineToMatch, int addedSpaces)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingRule.cs (2)
40IReadOnlyDictionary<string, (string value, TextLine? line)> conventionsDictionary, 41out (ReportDiagnostic severity, TextLine? line) value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingStyle.cs (1)
21IReadOnlyDictionary<string, (string value, TextLine? line)> properties,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (1)
24IReadOnlyDictionary<string, (string value, TextLine? line)> properties,
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)
152var 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)
46var lineToBeIndented = document.Text.Lines[lineNumber];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (3)
32var tokenLine = document.Text.Lines.GetLineFromPosition(token.SpanStart); 56var newTokenLine = newDocument.Text.Lines.GetLineFromPosition(newRoot.GetAnnotatedTokens(annotation).Single().SpanStart); 69var baseLine = sourceText.Lines.GetLineFromPosition(indentationResult.BasePosition);
Microsoft.CodeAnalysis.CSharp (1)
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
1282var line = referencedLines[lineNumberZeroBased];
Microsoft.CodeAnalysis.CSharp.CodeStyle (4)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
132private static bool IsAllWhitespace(TextLine textLine)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (2)
74var colonLine = sourceText.Lines.GetLineFromPosition(colonToken.SpanStart); 75var thisBaseLine = sourceText.Lines.GetLineFromPosition(thisOrBaseKeyword.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
206var 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)
50TextLine line,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (1)
29CompilationUnitSyntax root, SourceText text, TextLine lineToBeIndented,
Microsoft.CodeAnalysis.CSharp.EditorFeatures (9)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (3)
198var line = text.Lines.GetLineFromPosition(position); 258var line = text.Lines.GetLineFromPosition(position); 277private static bool LocatedAtTheEndOfLine(TextLine line, SyntaxToken lastToken)
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
250var 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 (31)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (2)
144var desiredCaretLine = GetLineBetweenCurlys(newClosingPoint, newDocument.Text); 163static TextLine GetLineBetweenCurlys(int closingPosition, SourceText text)
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (7)
298var line = text.Lines[i]; 352var interpolationLine = text.Lines.GetLineFromPosition(interpolation.SpanStart); 469var lineContainingPosition = text.Lines.GetLineFromPosition(position); 475private static void AppendFullLine(StringBuilder builder, TextLine line) 502var startLine = text.Lines.GetLineFromPosition(descendantSpan.Start); 531using var _3 = ArrayBuilder<TextLine>.GetInstance(out var lines); 632ArrayBuilder<TextLine> lines,
EditAndContinue\BreakpointSpans.cs (2)
23var line = source.Lines.GetLineFromPosition(position); 42private static bool IsBlank(TextLine line)
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (3)
74var firstLine = lines.GetLineFromPosition(token.Span.Start); 75var lastLine = lines.GetLineFromPosition(token.Span.End); 82var currentLine = lines[i];
ExtractMethod\CSharpSelectionValidator.cs (2)
526var line = text.Lines.GetLineFromPosition(textSpan.End); 534var previousLine = text.Lines[line.LineNumber - 1];
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)
132private static bool IsAllWhitespace(TextLine textLine)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (2)
74var colonLine = sourceText.Lines.GetLineFromPosition(colonToken.SpanStart); 75var 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)
845var 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)
624var openBraceLine = initialText.Lines[valueSetterLineIndex - 1]; 836var closeBraceLine = withOpenBraceDeletedLines[valueSetterLineIndex];
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
206var 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)
50TextLine line,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (1)
29CompilationUnitSyntax root, SourceText text, TextLine lineToBeIndented,
Microsoft.CodeAnalysis.EditorFeatures (19)
DocumentationComments\AbstractDocumentationCommentCommandHandler.cs (1)
356private 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)
152public override TextLine this[int index] 157return TextLine.FromSpan(_text, TextSpan.FromBounds(line.Start, line.End)); 164public override TextLine GetLineFromPosition(int position)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (7)
CodeFixes\CodeFixServiceTests.cs (1)
925var 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)
61var line = text.Lines.GetLineFromPosition(metadataAsSourceFile.IdentifierLocation.SourceSpan.Start);
Microsoft.CodeAnalysis.Features (64)
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)
110var line = lines[indexOfLine]; 127var line = lines[indexOfLine]; 277var lineAtPos = lines[indexOfLine];
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (2)
119TextLine line, 171var line = text.Lines.GetLineFromPosition(targetToken.Value.Span.End);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (10)
98var line = text.Lines.GetLineFromPosition(documentationComment!.FullSpan.Start); 155var line = text.Lines.GetLineFromPosition(documentationComment.FullSpan.Start); 192var line = text.Lines.GetLineFromPosition(startPosition); 285var currentLine = text.Lines.GetLineFromPosition(position); 308var line = text.Lines.GetLineFromPosition(startPosition); 359var currentLine = text.Lines.GetLineFromPosition(position); 366var previousLine = text.Lines[currentLine.LineNumber - 1]; 399public DocumentationCommentSnippet GetDocumentationCommentSnippetFromPreviousLine(in DocumentationCommentOptions options, TextLine currentLine, TextLine previousLine) 411private string CreateInsertionTextFromPreviousLine(TextLine previousLine, in DocumentationCommentOptions options)
DocumentationComments\IDocumentationCommentSnippetService.cs (2)
39TextLine currentLine, 40TextLine previousLine);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (1)
721var line = text.Lines.GetLineFromPosition(diagnostic.Span.Start);
QuickInfo\IndentationHelper.cs (2)
54var line = lines[lineNumber]; 118var 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)
133var startLine = text.Lines.GetLineFromPosition(fullSpan.Start); 134var endLine = text.Lines.GetLineFromPosition(fullSpan.End); 150var line = text.Lines[lineNumber];
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Handler\OnAutoInsert\OnAutoInsertHandler.cs (2)
181var caretLineInIndentedText = indentedText.Lines[desiredCaretLinePosition.Line]; 207TextLine lineToIndent,
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
189var line = text.Lines[startLine + currentLine];
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 (41)
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (2)
43var currentPartitionEndLine = originalSourceText.Lines.GetLineFromPosition(changes.First().Span.End); 48var 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)
48var activeSectionProperties = ImmutableDictionary.CreateBuilder<string, (string value, TextLine? line)>(AnalyzerConfigOptions.KeyComparer); 52var activeLine = default(TextLine); 53foreach (var textLine in text.Lines)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\IEditorConfigOptionAccumulator.cs (1)
15void ProcessSection(Section section, IReadOnlyDictionary<string, (string value, TextLine? line)> properties);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOptionAccumulator.cs (1)
25public void ProcessSection(Section section, IReadOnlyDictionary<string, (string value, TextLine? line)> properties)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
21var 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)
28var 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)
26public readonly TextLine LineToBeIndented; 47TextLine lineToBeIndented, 112var previousLine = this.Text.Lines[LineToBeIndented.LineNumber - 1]; 154var line = this.Text.Lines[currentLine]; 176var updatedLine = updatedSourceText.Lines[LineToBeIndented.LineNumber]; 212public IndentationResult GetIndentationOfLine(TextLine lineToMatch) 215public IndentationResult GetIndentationOfLine(TextLine lineToMatch, int addedSpaces)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingRule.cs (2)
40IReadOnlyDictionary<string, (string value, TextLine? line)> conventionsDictionary, 41out (ReportDiagnostic severity, TextLine? line) value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingStyle.cs (1)
21IReadOnlyDictionary<string, (string value, TextLine? line)> properties,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (1)
24IReadOnlyDictionary<string, (string value, TextLine? line)> properties,
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)
152var 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)
46var lineToBeIndented = document.Text.Lines[lineNumber];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (3)
32var tokenLine = document.Text.Lines.GetLineFromPosition(token.SpanStart); 56var newTokenLine = newDocument.Text.Lines.GetLineFromPosition(newRoot.GetAnnotatedTokens(annotation).Single().SpanStart); 69var 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)
16var line = virtualSnapshotPoint.GetContainingLine();
FindReferences\Entries\AbstractDocumentSpanEntry.cs (1)
104var line = text.Lines.GetLineFromPosition(position);
Implementation\AbstractEditorFactory.cs (2)
359foreach (var originalLine in originalText.Lines) 366var 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)
70var 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)