544 references to Lines
CSharpSyntaxGenerator (2)
SourceGenerator.cs (2)
83var line = inputText.Lines[xmlException.LineNumber - 1]; // LineNumber is one-based. 87var lineSpan = inputText.Lines.GetLinePositionSpan(span);
IdeCoreBenchmarks (1)
IncrementalSourceGeneratorBenchmarks.cs (1)
167var changedText = sourceText.WithChanges(new TextChange(sourceText.Lines[0].Span, $"// added text{i}"));
Microsoft.AspNetCore.App.Analyzers (4)
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (4)
200var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0; 212var lastLineExclusive = tokenIncludeDelimiters ? tokenSourceText.Lines.Count - 1 : tokenSourceText.Lines.Count; 217var currentLine = tokenSourceText.Lines[lineNumber];
Microsoft.AspNetCore.Http.Extensions.Tests (3)
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (3)
384if (expectedLines.Length != sourceText.Lines.Count) 386message = $"Line numbers do not match. Expected: {expectedLines.Length} lines, but generated {sourceText.Lines.Count}"; 390foreach (var textLine in sourceText.Lines)
Microsoft.AspNetCore.Http.Microbenchmarks (3)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (3)
384if (expectedLines.Length != sourceText.Lines.Count) 386message = $"Line numbers do not match. Expected: {expectedLines.Length} lines, but generated {sourceText.Lines.Count}"; 390foreach (var textLine in sourceText.Lines)
Microsoft.CodeAnalysis (23)
CommandLine\AnalyzerConfig.cs (1)
207foreach (var textLine in text.Lines)
DiagnosticAnalyzer\AnalysisContextInfo.cs (1)
112var lineSpan = text?.Lines?.GetLinePositionSpan(_node.Span);
Syntax\LineDirectiveMap.cs (2)
51var unmappedStartPos = sourceText.Lines.GetLinePosition(span.Start); 52var unmappedEndPos = sourceText.Lines.GetLinePosition(span.End);
Syntax\SyntaxTreeExtensions.cs (2)
71var position = text.Lines.GetLinePosition(index); 72var line = text.Lines[position.Line];
Text\ChangedText.cs (1)
266=> _newText.Lines;
Text\CompositeText.cs (9)
450accumulatedLineCount += (segment.Lines.Count - 1); 481var lineNumberWithinSegment = segment.Lines.IndexOf(segmentOffset); 502var firstSegmentTextLine = firstSegment.Lines[lineNumber - firstSegmentFirstLineNumber]; 514Debug.Assert((nextSegment.Lines.Count == 1) || 515(nextSegment.Lines.Count == 2 && nextSegment.Lines[1].SpanIncludingLineBreak.IsEmpty)); 517lineLength += nextSegment.Lines[0].SpanIncludingLineBreak.Length; 525Debug.Assert(lastSegment.Lines.Count >= 1); 527lineLength += lastSegment.Lines[0].SpanIncludingLineBreak.Length;
Text\LargeText.cs (1)
227/// Called from <see cref="SourceText.Lines"/> to initialize the <see cref="TextLineCollection"/>. Thereafter,
Text\SourceText.cs (1)
953/// Called from <see cref="Lines"/> to initialize the <see cref="TextLineCollection"/>. Thereafter,
Text\SubText.cs (4)
113var startLineInUnderlyingText = _subText.UnderlyingText.Lines.GetLineFromPosition(_subText.UnderlyingSpan.Start); 114var endLineInUnderlyingText = _subText.UnderlyingText.Lines.GetLineFromPosition(_subText.UnderlyingSpan.End); 157var underlyingTextLine = _subText.UnderlyingText.Lines[lineNumber + _startLineNumberInUnderlyingText]; 211var underlyingLineNumber = _subText.UnderlyingText.Lines.IndexOf(underlyingPosition);
Text\TextLine.cs (1)
111return _text?.Lines.IndexOf(_start) ?? 0;
Microsoft.CodeAnalysis.CodeStyle (21)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
131var lines = parenthesizedExpression.SyntaxTree.GetText(cancellationToken).Lines;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
71var position = text.Lines.GetLinePosition(index); 72var line = text.Lines[position.Line];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
53foreach (var textLine in text.Lines)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (6)
21var line = text.Lines.GetLineFromPosition(position); 48var startLineNumber = text.Lines.IndexOf(span.Start); 49var endLineNumber = text.Lines.IndexOf(span.End); 72var linePosition = text.Lines[lineNumber].Start; 89=> text.Lines.IndexOf(pos1) == text.Lines.IndexOf(pos2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
104var startLineNumber = text.Lines.IndexOf(span.Start); 105var endLineNumber = text.Lines.IndexOf(span.End); 111var linePosition = text.Lines[lineNumber].Start;
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.Indenter.cs (4)
112var previousLine = this.Text.Lines[LineToBeIndented.LineNumber - 1]; 154var line = this.Text.Lines[currentLine]; 174if (LineToBeIndented.LineNumber < updatedSourceText.Lines.Count) 176var updatedLine = updatedSourceText.Lines[LineToBeIndented.LineNumber];
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 (16)
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (5)
92var lines = text.Lines; 153var lines = text.Lines; 210var lines = text.Lines; 228var lines = text.Lines; 389=> text.Lines.GetLineFromPosition(position).SpanIncludingLineBreak.End;
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
69var diagnosticLinePositionSpan = text.Lines.GetLinePositionSpan(diagnosticSpan); 71text.Lines[diagnosticLinePositionSpan.Start.Line].Start, 72text.Lines[diagnosticLinePositionSpan.End.Line].End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (4)
236var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 237var locationLine = sourceText.Lines.GetLineFromPosition(location); 538var argumentStartLine = sourceText.Lines.GetLineFromPosition(typedAncestor.Span.Start).LineNumber; 539var caretLine = sourceText.Lines.GetLineFromPosition(position).LineNumber;
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 (7)
Symbols\Source\SourceMethodSymbolWithAttributes.cs (2)
1082var referencedLines = matchingTree.GetText().Lines; 1279var referencedLines = matchingTree.GetText().Lines;
Syntax\CSharpLineDirectiveMap.cs (3)
33var directiveLineNumber = sourceText.Lines.IndexOf(directiveNode.SpanStart) + 1; 182var unmappedPos = sourceText.Lines.GetLinePosition(position); 230var lines = sourceText.Lines;
Syntax\CSharpSyntaxTree.cs (2)
677return (map.Entries.Length == 1) ? Array.Empty<LineMapping>() : map.GetLineMappings(GetText(cancellationToken).Lines); 753=> GetText(cancellationToken).Lines.GetLinePosition(position);
Microsoft.CodeAnalysis.CSharp.CodeStyle (11)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
111var lines = text.Lines;
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\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (2)
303text.Lines.GetLineFromPosition(expression.SpanStart).LineNumber + 1 == text.Lines.GetLineFromPosition(expression.Span.End).LineNumber &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (4)
189var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0; 201var lastLineExclusive = tokenIncludeDelimiters ? tokenSourceText.Lines.Count - 1 : tokenSourceText.Lines.Count; 206var currentLine = tokenSourceText.Lines[lineNumber];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (2)
168var tokenLine = text.Lines.IndexOf(token.SpanStart); 169var previousTokenLine = text.Lines.IndexOf(previousToken.SpanStart);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
45var line = sourceText.Lines.GetLineFromPosition(position);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (24)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (3)
195var line = text.Lines.GetLineFromPosition(position); 255var line = text.Lines.GetLineFromPosition(position); 257if (!locatedAtTheEndOfLine && text.Lines.IndexOf(lastToken.Span.End) != line.LineNumber)
InlineRename\CSharpEditorInlineRenameService.cs (11)
115startLine = documentText.Lines.GetLineFromPosition(surroundingSpanOfInterest.Value.Start).LineNumber; 116endLine = documentText.Lines.GetLineFromPosition(surroundingSpanOfInterest.Value.End).LineNumber; 123var fallbackStartLine = Math.Max(0, documentText.Lines.GetLineFromPosition(fallbackSpan.Start).LineNumber - NumberOfContextLines); 124var fallbackEndLine = Math.Min(documentText.Lines.Count - 1, documentText.Lines.GetLineFromPosition(fallbackSpan.End).LineNumber + NumberOfContextLines); 130endLine = Math.Min(documentText.Lines.Count - 1, fallbackEndLine + excessAtStart); 151startLine = Math.Max(0, documentText.Lines.GetLineFromPosition(fallbackSpan.Start).LineNumber - NumberOfContextLines); 152endLine = Math.Min(documentText.Lines.Count - 1, documentText.Lines.GetLineFromPosition(fallbackSpan.End).LineNumber + NumberOfContextLines); 157startPosition = documentText.Lines[startLine].Start; 158endPosition = documentText.Lines[endLine].End;
StringCopyPaste\KnownSourcePasteProcessor.cs (3)
292for (var i = 0; i < sourceText.Lines.Count; i++) 297builder.Append(sourceText.ToString(sourceText.Lines[i].SpanIncludingLineBreak)); 338var hasNewLine = content.IsText && HasNewLine(lastContentSourceText!.Lines.Last());
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
250var lastLine = textBeforePaste.Lines.GetLineFromPosition(stringExpressionBeforePaste.Span.End);
StringCopyPaste\StringCopyPasteHelpers.cs (1)
504foreach (var line in text.Lines)
StringCopyPaste\UnknownSourcePasteProcessor.cs (5)
182for (var i = 0; i < textOfCurrentChange.Lines.Count; i++) 185var currentChangeLine = textOfCurrentChange.Lines[i]; 221HasNewLine(textOfCurrentChange.Lines.Last()); 248for (int lineIndex = 0, lastLineIndex = textOfCurrentChange.Lines.Count; lineIndex < lastLineIndex; lineIndex++) 254var currentChangeLine = textOfCurrentChange.Lines[lineIndex];
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (7)
Extensions\SyntaxTreeExtensionsTests.cs (2)
18var line = tree.GetText().Lines[lineNumber]; 27var line = tree.GetText().Lines[lineNumber];
Formatting\Indentation\SmartTokenFormatterFormatTokenTests.cs (2)
565SourceText.From(code).Lines.IndexOf(position), 632SourceText.From(code).Lines.IndexOf(position),
StringIndentation\StringIndentationTests.cs (3)
47var firstLine = text.Lines.GetLineFromPosition(region.IndentSpan.Start); 48var lastLine = text.Lines.GetLineFromPosition(region.IndentSpan.End); 53var lineStart = text.Lines[i].Start;
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 (57)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (5)
103var openingPointLine = originalDocumentText.Lines.GetLineFromPosition(openingPoint).LineNumber; 104var closingPointLine = originalDocumentText.Lines.GetLineFromPosition(closingPoint).LineNumber; 165var closingBraceLineNumber = text.Lines.GetLineFromPosition(closingPosition - 1).LineNumber; 166return text.Lines[closingBraceLineNumber - 1]; 174var baseLinePosition = sourceText.Lines.GetLinePosition(indentation.BasePosition);
BraceCompletion\ParenthesisBraceCompletionService.cs (2)
52return text.Lines.GetLineFromPosition(openParen.SpanStart).LineNumber == text.Lines.GetLineFromPosition(closeParen.Span.End).LineNumber;
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (2)
137&& text.Lines.IndexOf(syntaxToken.SpanStart) == text.Lines.IndexOf(touchingToken.SpanStart);
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (9)
300AppendFullLine(builder, text.Lines[0]); 302for (int i = 1, n = text.Lines.Count; i < n; i++) 304var line = text.Lines[i]; 358var interpolationLine = text.Lines.GetLineFromPosition(interpolation.SpanStart); 475var lineContainingPosition = text.Lines.GetLineFromPosition(position); 508var startLine = text.Lines.GetLineFromPosition(descendantSpan.Start); 509if (startLine != text.Lines.GetLineFromPosition(descendantSpan.End)) 538lines.AddRange(text.Lines); 603else if (line == text.Lines[1])
Debugging\CSharpProximityExpressionsService.Worker.cs (2)
155var line = _syntaxTree.GetText(cancellationToken).Lines.IndexOf(_position); 160nextStatement != null && _syntaxTree.GetText(cancellationToken).Lines.IndexOf(nextStatement.SpanStart) == line;
EditAndContinue\BreakpointSpans.cs (1)
23var line = source.Lines.GetLineFromPosition(position);
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (1)
73var lines = text.Lines;
ExtractMethod\CSharpSelectionValidator.cs (2)
538var line = text.Lines.GetLineFromPosition(textSpan.End); 546var previousLine = text.Lines[line.LineNumber - 1];
LineSeparators\CSharpLineSeparatorService.cs (3)
332var line = syntaxTree.GetText(cancellationToken).Lines.IndexOf(textSpan.End); 333if (line == syntaxTree.GetText(cancellationToken).Lines.Count - 1) 338if (string.IsNullOrWhiteSpace(syntaxTree.GetText(cancellationToken).Lines[line + 1].ToString()))
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)
111var lines = text.Lines;
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\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (2)
303text.Lines.GetLineFromPosition(expression.SpanStart).LineNumber + 1 == text.Lines.GetLineFromPosition(expression.Span.End).LineNumber &&
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (7)
116var semicolonLine = text.Lines.GetLineFromPosition(fileScopedNamespace.SemicolonToken.SpanStart).LineNumber; 122for (var line = semicolonLine + 1; line < text.Lines.Count; line++) 123changes.AddIfNotNull(TryDedentLine(text.Lines[line])); 165lastRawStringLiteralData = (stringNode, ComputeCommonIndentationLength(text.Lines.GetLineFromPosition(stringNode.Span.End))); 202var openBraceLine = text.Lines.GetLineFromPosition(blockScopedNamespace.OpenBraceToken.SpanStart).LineNumber; 203var closeBraceLine = text.Lines.GetLineFromPosition(blockScopedNamespace.CloseBraceToken.SpanStart).LineNumber; 207changes.AddIfNotNull(TryIndentLine(syntaxTree, root, indentation, text.Lines[line], cancellationToken));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
845var lineToConsider = text.Lines.GetLineFromPosition(expressionToReplace.SpanStart);
StringIndentation\CSharpStringIndentationService.cs (5)
142var holeStartLine = text.Lines.GetLineFromPosition(interpolation.SpanStart).LineNumber; 143var holeEndLine = text.Lines.GetLineFromPosition(interpolation.Span.End).LineNumber; 147var line = text.Lines[i]; 162var lastLine = text.Lines.GetLineFromPosition(expression.Span.End); 171var firstLine = text.Lines.GetLineFromPosition(expression.SpanStart);
Structure\Providers\ArgumentListStructureProvider.cs (2)
37var start = text.Lines.GetLinePosition(openToken.SpanStart).Line; 38var end = text.Lines.GetLinePosition(closeToken.SpanStart).Line;
Structure\Providers\IfDirectiveTriviaStructureProvider.cs (5)
42var startLineNumber = text.Lines.GetLineFromPosition(directive.SpanStart).LineNumber + 1; 43var endLineNumber = text.Lines.GetLineFromPosition(nextDirective.SpanStart).LineNumber - 1; 47if (startLineNumber >= text.Lines.Count || endLineNumber < 0) 50var startLine = text.Lines[startLineNumber]; 51var endLine = text.Lines[endLineNumber];
Structure\Providers\StringLiteralExpressionStructureProvider.cs (2)
50if (sourceText.Lines.GetLineFromPosition(span.Start).LineNumber != 51sourceText.Lines.GetLineFromPosition(span.End).LineNumber)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
315var oldStatementSpan = oldText.Lines.GetLinePositionSpan(oldStatementTextSpan); 338var newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (8)
Diagnostics\LineSpanDirectiveTests.cs (2)
246var actualVisibility = textB.Lines.Select(line => treeB.GetLineVisibility(line.Start)).ToImmutableArray(); 487var span = getTextSpan(mappedText.Lines, mappedLineAndPositionSpan.Span);
Diagnostics\LocationsTests.cs (1)
77return tree.GetLineMappings().Select(mapping => $"[|{text.GetSubText(text.Lines.GetTextSpan(mapping.Span))}|] -> {(mapping.IsHidden ? "<hidden>" : mapping.MappedSpan)}");
IncrementalParsing\IncrementalParsingTests.cs (3)
621var initialLines = initialText.Lines; 624var openBraceLine = initialText.Lines[valueSetterLineIndex - 1]; 835var withOpenBraceDeletedLines = withOpenBraceDeletedText.Lines;
Parsing\ParserRegressionTests.cs (1)
163var lines1 = tree.GetText().Lines.Count; // 3
Syntax\SyntaxNodeTests.cs (1)
787var position = tree.GetText().Lines[2].End - 1;
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (4)
189var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0; 201var lastLineExclusive = tokenIncludeDelimiters ? tokenSourceText.Lines.Count - 1 : tokenSourceText.Lines.Count; 206var currentLine = tokenSourceText.Lines[lineNumber];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (2)
168var tokenLine = text.Lines.IndexOf(token.SpanStart); 169var previousTokenLine = text.Lines.IndexOf(previousToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
45var line = sourceText.Lines.GetLineFromPosition(position);
Microsoft.CodeAnalysis.EditorFeatures (7)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (2)
181if (text.Lines.IndexOf(token.Span.End) != text.Lines.IndexOf(line.End))
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (3)
172foreach (var curLine in editorConfigText.Lines) 322var lines = editorConfigText.Lines; 350return (result, lastValidHeaderSpanEnd, result.Lines[^2]);
IntelliSense\AsyncCompletion\CompletionSource.cs (1)
598var startOfLine = text.Lines.GetLineFromPosition(questionPosition).Start;
Shared\Utilities\VirtualTreePoint.cs (1)
74=> Text.Lines.GetLineFromPosition(Position);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
LanguageServer\AbstractLanguageServerProtocolTests.cs (1)
179var lines = text.Lines;
Squiggles\TestDiagnosticTagProducer.cs (1)
32var linePosSpan = sourceText.Lines.GetLinePositionSpan(span);
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Extensions.cs (1)
37=> line.Snapshot.AsText().Lines[line.LineNumber];
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (9)
CodeFixes\CodeFixServiceTests.cs (3)
923if (text == null || text.Lines.Count == 0) 925var line = text.Lines[0]; 927var location = Location.Create(context.AdditionalFile.Path, span, text.Lines.GetLinePositionSpan(span));
EditorAdapter\TextSnapshotImplementationTest.cs (4)
32Assert.Equal(tuple.Item1.LineCount, text.Lines.Count); 42var line1 = text.Lines[0]; 53var line1 = text.Lines[1]; 63var lines = tuple.Item2.Lines;
Extensions\ITextLineExtensionsTests.cs (1)
130return text.Lines[0];
MetadataAsSource\AbstractMetadataAsSourceTests.cs (1)
61var line = text.Lines.GetLineFromPosition(metadataAsSourceFile.IdentifierLocation.SourceSpan.Start);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
85Boolean.TryParse(text.Lines(0).ToString(), serializationAllowed)
Microsoft.CodeAnalysis.Features (43)
ClassifiedSpansAndHighlightSpanFactory.cs (1)
46var sourceLine = sourceText.Lines.GetLineFromPosition(referenceSpan.Start);
CodeFixes\Configuration\ConfigurationUpdater.cs (2)
450foreach (var curLine in result.Lines) 740var lines = result.Lines;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (1)
275var lines = syntaxTree.GetText(cancellationToken).Lines;
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
185var line = text.Lines.GetLineFromPosition(endToken.Value.Span.End);
Completion\Providers\AbstractOverrideCompletionProvider.BaseItemGetter.cs (1)
57=> Text.Lines.IndexOf(position) == StartLineNumber;
Completion\Providers\AbstractOverrideCompletionProvider.cs (1)
70=> text.Lines.IndexOf(position) == startLine;
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
68var lineStart = text.Lines.GetLineFromPosition(caretPosition).Start;
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (12)
56var line = text.Lines.GetLineFromPosition(commentStart); 119var line = text.Lines.GetLineFromPosition(documentationComment!.FullSpan.Start); 176var line = text.Lines.GetLineFromPosition(documentationComment.FullSpan.Start); 213var line = text.Lines.GetLineFromPosition(startPosition); 280var line = text.Lines.GetLineFromPosition(position); 284var previousLine = text.Lines[line.LineNumber - 1]; 314var currentLine = text.Lines.GetLineFromPosition(position); 337var line = text.Lines.GetLineFromPosition(startPosition); 388var currentLine = text.Lines.GetLineFromPosition(position); 395var previousLine = text.Lines[currentLine.LineNumber - 1]; 402var nextLineStartsWithDocComment = text.Lines.Count > currentLine.LineNumber + 1 && 403text.Lines[currentLine.LineNumber + 1].ToString().Trim().StartsWith(ExteriorTriviaText, StringComparison.Ordinal);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
721var line = text.Lines.GetLineFromPosition(diagnostic.Span.Start); 1319var trackedSpan = text.Lines.GetTextSpan(trackedLineSpan);
EditAndContinue\ActiveStatementsMap.cs (1)
200if (TryGetTextSpan(oldText.Lines, unmappedLineSpan, out var unmappedSpan) &&
EditAndContinue\EditSession.cs (8)
214var oldLineCount = oldText.Lines.Count; 215var newLineCount = newText.Lines.Count; 219var oldLineSpan = oldText.Lines[i].Span; 220var newLineSpan = newText.Lines[i].Span; 223return newText.Lines[i].Span; 228(newLineCount > oldLineCount) ? newText.Lines[oldLineCount].Span : 229TextSpan.FromBounds(newText.Lines[newLineCount - 1].End, newText.Lines[newLineCount - 1].EndIncludingLineBreak);
QuickInfo\IndentationHelper.cs (2)
42var lines = text.Lines; 88var lines = text.Lines;
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
131var lines = parenthesizedExpression.SyntaxTree.GetText(cancellationToken).Lines;
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (5)
92var lines = text.Lines; 153var lines = text.Lines; 210var lines = text.Lines; 228var lines = text.Lines; 389=> text.Lines.GetLineFromPosition(position).SpanIncludingLineBreak.End;
TaskList\AbstractTaskListService.cs (3)
133var startLine = text.Lines.GetLineFromPosition(fullSpan.Start); 134var endLine = text.Lines.GetLineFromPosition(fullSpan.End); 150var line = text.Lines[lineNumber];
Wrapping\AbstractCodeActionComputer.cs (1)
98var originalLineNumber = newSourceText.Lines.GetLineFromPosition(nodeOrToken.Span.End).LineNumber;
Microsoft.CodeAnalysis.Features.Test.Utilities (5)
EditAndContinue\ActiveStatementsDescription.cs (1)
90SelectAsArray(s => new ActiveStatementLineSpan(new ActiveStatementId(s.id), newText.Lines.GetLinePositionSpan(s.span)));
EditAndContinue\ActiveStatementTestHelpers.cs (1)
114=> text.Lines[span.Start.Line].ToString().Trim();
EditAndContinue\EditAndContinueTestVerifier.cs (1)
484var code = text.GetSubText(text.Lines.GetTextSpan(span.Span)).ToString().Replace("\r\n", " ");
EditAndContinue\Extensions.cs (1)
33firstLine: includeFirstLines ? newSource.Lines.GetLineFromPosition(d.Span.Start).ToString().Trim() : null));
EditAndContinue\RuntimeRudeEditDescription.cs (1)
14=> new RudeEditDiagnostic(kind, tree.GetText().Lines.GetTextSpan(new LinePositionSpan(position, position)), syntaxKind: 0, arguments).ToDiagnostic(tree).ToString();
Microsoft.CodeAnalysis.Features.UnitTests (6)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (2)
1034var activeLineSpan1 = CreateText(source1).Lines.GetLinePositionSpan(GetSpan(source1, "System.Console.WriteLine(1);")); 1035var activeLineSpan2 = CreateText(source2).Lines.GetLinePositionSpan(GetSpan(source2, "System.Console.WriteLine(2);"));
EditAndContinue\EditSessionActiveStatementsTests.cs (4)
492var erPreRemap20 = new SourceFileSpan(filePath, sourceTextV1.Lines.GetLinePositionSpan(exceptionSpans[2][0])); 493var erPreRemap21 = new SourceFileSpan(filePath, sourceTextV1.Lines.GetLinePositionSpan(exceptionSpans[2][1])); 495var erPreRemap30 = new SourceFileSpan(filePath, sourceTextV1.Lines.GetLinePositionSpan(exceptionSpans[3][0])); 496var erPreRemap31 = new SourceFileSpan(filePath, sourceTextV1.Lines.GetLinePositionSpan(exceptionSpans[3][1]));
Microsoft.CodeAnalysis.LanguageServer.Protocol (10)
Extensions\ProtocolConversions.cs (4)
282Position = LinePositionToPosition(text.Lines.GetLinePosition(position)) 306return text.Lines.GetTextSpan(linePositionSpan); 311throw new ArgumentException($"Range={RangeToString(range)}. text.Length={text.Length}. text.Lines.Count={text.Lines.Count}", ex); 351var linePosSpan = text.Lines.GetLinePositionSpan(textSpan);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (1)
452if (existingData.LineCount == _text.Lines.Count &&
Handler\FoldingRanges\FoldingRangesHandler.cs (1)
98var linePositionSpan = text.Lines.GetLinePositionSpan(span.TextSpan);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (3)
185var caretLineInIndentedText = indentedText.Lines[desiredCaretLinePosition.Line]; 186desiredCaretLinePosition = indentedText.Lines.GetLinePosition(caretLineInIndentedText.End); 233var desiredCaretLocation = sourceText.Lines.GetPosition(desiredCaretLinePosition);
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
189var line = text.Lines[startLine + currentLine];
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
Diagnostics\AbstractPullDiagnosticTestsBase.cs (1)
224var lineInfo = sourceText.Lines.GetLinePositionSpan(new TextSpan(position, 0));
ProtocolConversionsTests.cs (1)
254var range = new Range() { Start = new Position(0, 0), End = new Position(sourceText.Lines.Count, 0) };
SemanticTokens\AbstractSemanticTokensTests.cs (1)
99var lineLength = text.Lines[currentLine].SpanIncludingLineBreak.Length;
SpellCheck\SpellCheckTests.cs (1)
651var lineInfo = sourceText.Lines.GetLinePositionSpan(new TextSpan(position, 0));
Microsoft.CodeAnalysis.Test.Utilities (6)
Diagnostics\CommonDiagnosticAnalyzers.cs (1)
2660var location = Location.Create(context.AdditionalFile.Path, _diagnosticSpan, text.Lines.GetLinePositionSpan(_diagnosticSpan));
Diagnostics\DiagnosticDescription.cs (1)
543assertText.AppendLine(l.SourceTree.GetText().Lines.GetLineFromPosition(l.SourceSpan.Start).ToString());
Metadata\ILValidation.cs (3)
422var span = text.Lines.GetTextSpan(lineSpan); 436var start = subtext.Lines[0].ToString(); 437var end = subtext.Lines[^1].ToString();
SourceGeneration\TestGenerators.cs (1)
161return $"'{Path}': '{_content.Lines[0]}'";
Microsoft.CodeAnalysis.UnitTests (84)
Text\CompositeTextTests.cs (4)
36var sourceLinesText = GetLinesTexts(sourceText.Lines); 37var compositeLinesText = GetLinesTexts(compositeText.Lines); 43Assert.Equal(sourceText.Lines.IndexOf(i), compositeText.Lines.IndexOf(i));
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\SourceTextTests.cs (2)
47Assert.Equal(1, text.Lines.Count); 48Assert.Equal(0, text.Lines[0].Span.Length);
Text\StringTextDecodingTests.cs (4)
245Assert.Equal(1, text.Lines.Count); 246Assert.Equal(3, text.Lines[0].Span.Length); 275Assert.Equal(1, text.Lines.Count); 276Assert.Equal(3, text.Lines[0].Span.Length);
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\TextChangeTests.cs (5)
208Assert.Equal(1, newText.Lines.Count); 271Assert.Equal(SourceText.From(changedText.ToString()).Lines, changedText.Lines, new TextLineEqualityComparer()); 350var lines = text.Lines; 370var lines = text.Lines;
Microsoft.CodeAnalysis.VisualBasic (11)
CommandLine\CommandLineDiagnosticFormatter.vb (5)
63Dim linenumber = text.Lines.IndexOf(sourceSpanStart) 64Dim line = text.Lines(linenumber) 71line = text.Lines(linenumber) 115If linenumber >= text.Lines.Count Then 120line = text.Lines(linenumber)
Syntax\VisualBasicLineDirectiveMap.vb (4)
34Dim directiveLineNumber As Integer = sourceText.Lines.IndexOf(directive.SpanStart) + 1 148Dim unmappedPos As LinePosition = sourceText.Lines.GetLinePosition(position) 210Dim unmappedStartPos = sourceText.Lines.GetLinePosition(span.Start) 211Dim unmappedEndPos = sourceText.Lines.GetLinePosition(span.End)
Syntax\VisualBasicSyntaxTree.vb (2)
465Return If(map.Entries.Length = 1, Array.Empty(Of LineMapping)(), map.GetLineMappings(GetText(cancellationToken).Lines)) 485Return Me.GetText().Lines.GetLinePosition(position)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTokenExtensions.vb (2)
203Dim tokenLine = text.Lines.IndexOf(token.SpanStart) 204Dim previousTokenLine = text.Lines.IndexOf(previousToken.SpanStart)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (2)
358Dim line = syntaxTree.GetText(cancellationToken).Lines(lineNumber) 363syntaxTree.GetText(cancellationToken).Lines.IndexOf(statement.SpanStart) = lineNumber Then
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeRefactorings\VisualBasicRefactoringHelpersService.vb (1)
38Dim line = sourceText.Lines.GetLineFromPosition(position)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (1)
132Dim lineNumber = sourceText.Lines.GetLineFromPosition(argument.SpanStart).LineNumber
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (7)
Utilities\CommandHandlers\AbstractImplementAbstractClassOrInterfaceCommandHandler.vb (2)
148If text.Lines.IndexOf(token.SpanStart) <> text.Lines.IndexOf(caretPosition) Then
Utilities\NavigationPointHelpers.vb (5)
15line = text.Lines.GetLineFromPosition(GetHeaderStartPosition(eventBlock)).LineNumber 17line = text.Lines.GetLineFromPosition(eventBlock.EventStatement.Span.End).LineNumber + 1 26line = text.Lines.GetLineFromPosition(GetHeaderStartPosition(methodBlock)).LineNumber 28line = text.Lines.GetLineFromPosition(methodBlock.BlockStatement.Span.End).LineNumber + 1 52Dim line = text.Lines(lineNumber)
Microsoft.CodeAnalysis.VisualBasic.Features (13)
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.MoveToLineCodeAction.vb (2)
34Dim destinationLineSpan = text.Lines(_destinationLine).Start 37Dim textLineToMove = text.Lines(lineToMove)
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.vb (1)
197Dim position = text.Lines(destinationLine).Start
Debugging\LocationInfoGetter.vb (2)
43Dim lineNumber = text.Lines.GetLineFromPosition(position).LineNumber 44Dim memberLine = text.Lines.GetLineFromPosition(memberDeclaration.GetMemberBlockBegin().SpanStart).LineNumber
Debugging\ProximityExpressionsGetter.Worker.vb (2)
86Dim line = _syntaxTree.GetText(cancellationToken).Lines.IndexOf(_position) 89While nextStatement IsNot Nothing AndAlso _syntaxTree.GetText(cancellationToken).Lines.IndexOf(nextStatement.SpanStart) = line
EditAndContinue\BreakpointSpans.vb (1)
17Dim line = source.Lines.GetLineFromPosition(position)
ExtractMethod\VisualBasicSelectionValidator.vb (2)
641Dim line = root.GetText().Lines.GetLineFromPosition(textSpan.End) 648Dim previousLine = root.GetText().Lines(line.LineNumber - 1)
Highlighting\KeywordHighlightingHelpers.vb (2)
89Dim previousLine = text.Lines.IndexOf(previousToken.SpanStart) 90Dim awaitLine = text.Lines.IndexOf(.AwaitKeyword.SpanStart)
Structure\Providers\XmlExpressionStructureProvider.vb (1)
27Dim line = syntaxTree.GetText(cancellationToken).Lines.GetLineFromPosition(span.Start)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (1)
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (1)
502Dim newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (3)
LocationTests.vb (1)
64Return tree.GetLineMappings().Select(Function(mapping) $"[|{text.GetSubText(text.Lines.GetTextSpan(mapping.Span))}|] -> {If(mapping.IsHidden, "<hidden>", mapping.MappedSpan.ToString())}")
Syntax\ManualTests.vb (1)
227Dim token = tree.GetRoot().FindToken(text.Lines.Item(3).Start)
TestSyntaxNodes.vb (1)
2349Dim position = tree.GetText().Lines(1).End
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (1)
CompilationTestUtils.vb (1)
1025Dim textLine = text.Lines.GetLineFromPosition(position)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (9)
Simplification\Reducers\VisualBasicEscapingReducer.vb (3)
155Dim endLineOfQuery = text.Lines.GetLineFromPosition(lastTokenOfQuery.Span.End).LineNumber 156Dim startLineOfCurrentToken = text.Lines.GetLineFromPosition(identifier.SpanStart).LineNumber 183If text.Lines(i).IsEmptyOrWhitespace() Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTokenExtensions.vb (2)
203Dim tokenLine = text.Lines.IndexOf(token.SpanStart) 204Dim previousTokenLine = text.Lines.IndexOf(previousToken.SpanStart)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (2)
358Dim line = syntaxTree.GetText(cancellationToken).Lines(lineNumber) 363syntaxTree.GetText(cancellationToken).Lines.IndexOf(statement.SpanStart) = lineNumber Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeRefactorings\VisualBasicRefactoringHelpersService.vb (1)
38Dim line = sourceText.Lines.GetLineFromPosition(position)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (1)
132Dim lineNumber = sourceText.Lines.GetLineFromPosition(argument.SpanStart).LineNumber
Microsoft.CodeAnalysis.Workspaces (45)
Diagnostics\Extensions.cs (1)
66return Location.Create(textDocument.FilePath, span, text.Lines.GetLinePositionSpan(span));
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (11)
38var currentPartitionEndLine = originalSourceText.Lines.GetLineFromPosition(changes.First().Span.End); 43var changeStartLine = originalSourceText.Lines.GetLineFromPosition(change.Span.Start); 51currentPartitionEndLine = originalSourceText.Lines.GetLineFromPosition(change.Span.End); 71var startLineStartPosition = oldDocumentText.Lines.GetLineFromPosition(startPosition).Start; 72var endLineEndPosition = oldDocumentText.Lines.GetLineFromPosition(endPosition).End; 127for (startLine = 0; startLine < text.Lines.Count; startLine++) 129if (!text.Lines[startLine].IsEmptyOrWhitespace()) 135for (endLine = text.Lines.Count - 1; endLine > startLine; endLine--) 137if (!text.Lines[endLine].IsEmptyOrWhitespace()) 144? text.GetSubText(TextSpan.FromBounds(text.Lines[startLine].Start, text.Lines[endLine].End)).ToString()
Shared\Extensions\FileLinePositionSpanExtensions.cs (4)
31return text.Lines.GetTextSpan(clampedSpan); 40var lines = text.Lines; 89Contract.ThrowIfTrue(start < text.Lines.GetLinePosition(0)); 90Contract.ThrowIfTrue(end > text.Lines.GetLinePosition(text.Length));
Shared\Extensions\SourceTextExtensions.cs (1)
37var line = text.Lines.GetLineFromPosition(position);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
71var position = text.Lines.GetLinePosition(index); 72var line = text.Lines[position.Line];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
53foreach (var textLine in text.Lines)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (6)
21var line = text.Lines.GetLineFromPosition(position); 48var startLineNumber = text.Lines.IndexOf(span.Start); 49var endLineNumber = text.Lines.IndexOf(span.End); 72var linePosition = text.Lines[lineNumber].Start; 89=> text.Lines.IndexOf(pos1) == text.Lines.IndexOf(pos2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
104var startLineNumber = text.Lines.IndexOf(span.Start); 105var endLineNumber = text.Lines.IndexOf(span.End); 111var linePosition = text.Lines[lineNumber].Start;
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.Indenter.cs (4)
112var previousLine = this.Text.Lines[LineToBeIndented.LineNumber - 1]; 154var line = this.Text.Lines[currentLine]; 174if (LineToBeIndented.LineNumber < updatedSourceText.Lines.Count) 176var updatedLine = updatedSourceText.Lines[LineToBeIndented.LineNumber];
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 (4)
236var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 237var locationLine = sourceText.Lines.GetLineFromPosition(location); 538var argumentStartLine = sourceText.Lines.GetLineFromPosition(typedAncestor.Span.Start).LineNumber; 539var caretLine = sourceText.Lines.GetLineFromPosition(position).LineNumber;
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.Workspaces.Test.Utilities (1)
GenerateFileForEachAdditionalFileWithContentsCommented.cs (1)
32var changes = sourceText.Lines.SelectAsArray(l => new TextChange(new TextSpan(l.Start, length: 0), "// "));
Microsoft.CodeAnalysis.Workspaces.UnitTests (4)
SolutionTests\ProjectSemanticVersionTests.cs (4)
156var position = text.Lines[1].Start; 170var position = text.Lines[2].Start; 198var position = text.Lines[1].Start; 212var position = text.Lines[1].Start;
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 (26)
CallHierarchy\CallHierarchyDetail.cs (2)
44var start = location.SourceTree.GetText().Lines[lineSpan.StartLinePosition.Line].Start; 45var end = location.SourceTree.GetText().Lines[lineSpan.EndLinePosition.Line].End;
Diagnostics\VisualStudioVenusSpanMappingService.cs (1)
75return location.SourceTree.GetText().Lines;
Extensions\DocumentExtensions.cs (3)
29foreach (var line in text.Lines) 46start = text.Lines[line.LineNumber + 1].Start; 51var previousLine = text.Lines[line.LineNumber - 1];
FindReferences\Entries\AbstractDocumentSpanEntry.cs (3)
86return new MappedSpanResult(documentSpan.Document.FilePath, sourceText.Lines.GetLinePositionSpan(documentSpan.SourceSpan), documentSpan.SourceSpan); 94return new MappedSpanResult(documentSpan.Document.FilePath, sourceText.Lines.GetLinePositionSpan(documentSpan.SourceSpan), documentSpan.SourceSpan); 104var line = text.Lines.GetLineFromPosition(position);
FindReferences\Entries\DocumentSpanEntry.cs (4)
235var lineNumber = sourceText.Lines.GetLineFromPosition(referenceSpan.Start).LineNumber; 237var lastLineNumber = Math.Min(sourceText.Lines.Count - 1, lineNumber + AdditionalLineCountPerSide); 240sourceText.Lines[firstLineNumber].Start, 241sourceText.Lines[lastLineNumber].End);
Implementation\AbstractEditorFactory.cs (2)
359foreach (var originalLine in originalText.Lines) 366var currentLine = formattedText.Lines[originalLine.LineNumber];
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (2)
62var start = text.Lines[ts.iStartLine].Start + ts.iStartIndex; 63var end = text.Lines[ts.iEndLine].Start + ts.iEndIndex;
Progression\GraphQueries\IsUsedByGraphQuery.cs (1)
56var lineText = location.SourceTree.GetText(cancellationToken).Lines[span.StartLinePosition.Line].ToString();
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 (2)
70var line = text.Lines.GetLineFromPosition(position); 73line = text.Lines[line.LineNumber - 1];
Microsoft.VisualStudio.LanguageServices.CSharp (11)
CodeModel\CSharpCodeModelService.NodeLocator.cs (11)
139var openBraceLine = text.Lines.GetLineFromPosition(openBrace.Span.End); 143? new VirtualTreePoint(openBrace.SyntaxTree, text, text.Lines[openBraceLine.LineNumber + 1].Start) 153var openBraceLine = text.Lines.GetLineFromPosition(openBrace.SpanStart); 154var closeBraceLine = text.Lines.GetLineFromPosition(closeBrace.SpanStart); 174openBraceLine.LineNumber < text.Lines.IndexOf(tokenAfterOpenBrace.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.UnitTests (9)
Venus\DocumentService_IntegrationTests.vb (9)
90(definitionDocument.Name, definitionText.Lines.GetLinePositionSpan(definitionSpan).Start, definitionText.Lines.GetLineFromPosition(definitionSpan.Start).ToString().Trim()), 91(definitionDocument.Name, definitionText.Lines.GetLinePositionSpan(referenceSpan).Start, definitionText.Lines.GetLineFromPosition(referenceSpan.Start).ToString().Trim())} 155Dim expected = {(definitionDocument.Name, definitionText.Lines.GetLinePositionSpan(referenceSpan).Start, definitionText.Lines.GetLineFromPosition(referenceSpan.Start).ToString())} 284Dim lineSpan = mappedSource.Lines.GetLinePositionSpan(mappedSpan) 288Dim lineSpan = mappedSource.Lines.GetLinePositionSpan(mappedSpan) 327Dim line = mappedSource.Lines.GetLineFromPosition(mappedSpan.Start)
Microsoft.VisualStudio.LanguageServices.VisualBasic (16)
CodeModel\VisualBasicCodeModelService.NodeLocator.vb (16)
334Dim statementLine = text.Lines.GetLineFromPosition(statement.SpanStart) 338Dim nextStatementLine As Nullable(Of TextLine) = If(nextStatement IsNot Nothing, text.Lines.GetLineFromPosition(nextStatement.SpanStart), Nothing) 346startPosition = text.Lines(statementLine.LineNumber + 1).Start 406Dim statementLine = text.Lines.GetLineFromPosition(statement.SpanStart) 409Dim nextStatementLine As Nullable(Of TextLine) = If(nextStatement IsNot Nothing, text.Lines.GetLineFromPosition(nextStatement.SpanStart), Nothing) 417startPosition = text.Lines(statementLine.LineNumber + 1).Start 506Dim startLine = text.Lines.GetLineFromPosition(NavigationPointHelpers.GetHeaderStartPosition(methodBlock)) 507startPosition = text.Lines(startLine.LineNumber + 1).Start 728Dim beginLine = text.Lines.IndexOf(propertyStatement.Span.End) 731startPosition = text.Lines(lineNumber).Start 815Dim startLine = text.Lines.GetLineFromPosition(NavigationPointHelpers.GetHeaderStartPosition(eventBlock)) 816startPosition = text.Lines(startLine.LineNumber + 1).Start 1002Dim beginLine = text.Lines.IndexOf(beginStatement.SpanStart) 1008lineNumber = text.Lines.IndexOf(colonTrivia.Value.SpanStart) 1026Dim beginLine = text.Lines.IndexOf(beginStatement.SpanStart) 1029startPosition = text.Lines(lineNumber).Start
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Implementation\LanguageServer\Handler\Completion\CompletionHandler.cs (1)
105Range = ProtocolConversions.LinePositionToRange(text.Lines.GetLinePositionSpan(xamlCompletion.Span.Value))