2 overrides of GetLineFromPosition
Microsoft.CodeAnalysis (1)
Text\SourceText.cs (1)
1037public override TextLine GetLineFromPosition(int position)
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Extensions.SnapshotSourceText.cs (1)
164public override TextLine GetLineFromPosition(int position)
156 references to GetLineFromPosition
Microsoft.AspNetCore.App.Analyzers (1)
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (1)
200var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0;
Microsoft.CodeAnalysis (3)
Text\SubText.cs (2)
113var startLineInUnderlyingText = _subText.UnderlyingText.Lines.GetLineFromPosition(_subText.UnderlyingSpan.Start); 114var endLineInUnderlyingText = _subText.UnderlyingText.Lines.GetLineFromPosition(_subText.UnderlyingSpan.End);
Text\TextLineCollection.cs (1)
48var line = GetLineFromPosition(position);
Microsoft.CodeAnalysis.CodeStyle (6)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
132var expressionFirstLine = lines.GetLineFromPosition(parenthesizedExpressionLocation.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
21var line = text.Lines.GetLineFromPosition(position);
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\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 (12)
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (6)
93var conflictLine = lines.GetLineFromPosition(position); 158startLine = lines.GetLineFromPosition(position); 169firstMiddleLine = lines.GetLineFromPosition(position); 174secondMiddleLine = lines.GetLineFromPosition(position); 185endLine = lines.GetLineFromPosition(position); 389=> text.Lines.GetLineFromPosition(position).SpanIncludingLineBreak.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\IIndentationService.cs (2)
32var tokenLine = document.Text.Lines.GetLineFromPosition(token.SpanStart); 56var newTokenLine = newDocument.Text.Lines.GetLineFromPosition(newRoot.GetAnnotatedTokens(annotation).Single().SpanStart);
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (2)
112var firstBraceLine = lines.GetLineFromPosition(firstBrace.SpanStart).LineNumber; 113var secondBraceLine = lines.GetLineFromPosition(secondBrace.SpanStart).LineNumber;
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 (1)
189var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0;
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 (9)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (2)
195var line = text.Lines.GetLineFromPosition(position); 255var line = text.Lines.GetLineFromPosition(position);
InlineRename\CSharpEditorInlineRenameService.cs (6)
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); 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);
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
250var lastLine = textBeforePaste.Lines.GetLineFromPosition(stringExpressionBeforePaste.Span.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 (32)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (3)
103var openingPointLine = originalDocumentText.Lines.GetLineFromPosition(openingPoint).LineNumber; 104var closingPointLine = originalDocumentText.Lines.GetLineFromPosition(closingPoint).LineNumber; 165var closingBraceLineNumber = text.Lines.GetLineFromPosition(closingPosition - 1).LineNumber;
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (4)
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))
EditAndContinue\BreakpointSpans.cs (1)
23var line = source.Lines.GetLineFromPosition(position);
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (2)
70var firstLine = lines.GetLineFromPosition(token.Span.Start); 71var lastLine = lines.GetLineFromPosition(token.Span.End);
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 (2)
112var firstBraceLine = lines.GetLineFromPosition(firstBrace.SpanStart).LineNumber; 113var secondBraceLine = lines.GetLineFromPosition(secondBrace.SpanStart).LineNumber;
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 (4)
116var semicolonLine = text.Lines.GetLineFromPosition(fileScopedNamespace.SemicolonToken.SpanStart).LineNumber; 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;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
845var lineToConsider = text.Lines.GetLineFromPosition(expressionToReplace.SpanStart);
StringIndentation\CSharpStringIndentationService.cs (4)
142var holeStartLine = text.Lines.GetLineFromPosition(interpolation.SpanStart).LineNumber; 143var holeEndLine = text.Lines.GetLineFromPosition(interpolation.Span.End).LineNumber; 162var lastLine = text.Lines.GetLineFromPosition(expression.Span.End); 171var firstLine = text.Lines.GetLineFromPosition(expression.SpanStart);
Structure\Providers\IfDirectiveTriviaStructureProvider.cs (2)
42var startLineNumber = text.Lines.GetLineFromPosition(directive.SpanStart).LineNumber + 1; 43var endLineNumber = text.Lines.GetLineFromPosition(nextDirective.SpanStart).LineNumber - 1;
Structure\Providers\StringLiteralExpressionStructureProvider.cs (2)
50if (sourceText.Lines.GetLineFromPosition(span.Start).LineNumber != 51sourceText.Lines.GetLineFromPosition(span.End).LineNumber)
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
189var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (1)
45var line = sourceText.Lines.GetLineFromPosition(position);
Microsoft.CodeAnalysis.EditorFeatures (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.Features (22)
ClassifiedSpansAndHighlightSpanFactory.cs (1)
46var sourceLine = sourceText.Lines.GetLineFromPosition(referenceSpan.Start);
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
68var lineStart = text.Lines.GetLineFromPosition(caretPosition).Start;
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (6)
56var line = text.Lines.GetLineFromPosition(commentStart); 213var line = text.Lines.GetLineFromPosition(startPosition); 280var line = text.Lines.GetLineFromPosition(position); 314var currentLine = text.Lines.GetLineFromPosition(position); 337var line = text.Lines.GetLineFromPosition(startPosition); 388var currentLine = text.Lines.GetLineFromPosition(position);
QuickInfo\IndentationHelper.cs (4)
48var startLineNumber = lines.GetLineFromPosition(span.Start).LineNumber; 49var endLineNumber = lines.GetLineFromPosition(span.End).LineNumber; 92var startLineNumber = lines.GetLineFromPosition(span.TextSpan.Start).LineNumber; 93var endLineNumber = lines.GetLineFromPosition(span.TextSpan.End).LineNumber;
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
132var expressionFirstLine = lines.GetLineFromPosition(parenthesizedExpressionLocation.SourceSpan.Start);
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (6)
93var conflictLine = lines.GetLineFromPosition(position); 158startLine = lines.GetLineFromPosition(position); 169firstMiddleLine = lines.GetLineFromPosition(position); 174secondMiddleLine = lines.GetLineFromPosition(position); 185endLine = lines.GetLineFromPosition(position); 389=> text.Lines.GetLineFromPosition(position).SpanIncludingLineBreak.End;
TaskList\AbstractTaskListService.cs (2)
133var startLine = text.Lines.GetLineFromPosition(fullSpan.Start); 134var endLine = text.Lines.GetLineFromPosition(fullSpan.End);
Wrapping\AbstractCodeActionComputer.cs (1)
98var originalLineNumber = newSourceText.Lines.GetLineFromPosition(nodeOrToken.Span.End).LineNumber;
Microsoft.CodeAnalysis.Test.Utilities (1)
Diagnostics\DiagnosticDescription.cs (1)
543assertText.AppendLine(l.SourceTree.GetText().Lines.GetLineFromPosition(l.SourceSpan.Start).ToString());
Microsoft.CodeAnalysis.UnitTests (6)
Text\LargeTextTests.cs (3)
173CheckEqualLine(textLine, text.Lines.GetLineFromPosition(p)); 181CheckNotEqualLine(textLine, text.Lines.GetLineFromPosition(start - 1)); 189CheckNotEqualLine(textLine, text.Lines.GetLineFromPosition(nextPosition));
Text\StringTextTest.cs (3)
126CheckEqualLine(textLine, text.Lines.GetLineFromPosition(p)); 134CheckNotEqualLine(textLine, text.Lines.GetLineFromPosition(start - 1)); 142CheckNotEqualLine(textLine, text.Lines.GetLineFromPosition(nextPosition));
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 (4)
Utilities\NavigationPointHelpers.vb (4)
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
Microsoft.CodeAnalysis.VisualBasic.Features (3)
Debugging\LocationInfoGetter.vb (1)
43Dim lineNumber = text.Lines.GetLineFromPosition(position).LineNumber
EditAndContinue\BreakpointSpans.vb (1)
17Dim line = source.Lines.GetLineFromPosition(position)
Structure\Providers\XmlExpressionStructureProvider.vb (1)
27Dim line = syntaxTree.GetText(cancellationToken).Lines.GetLineFromPosition(span.Start)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (1)
CompilationTestUtils.vb (1)
1025Dim textLine = text.Lines.GetLineFromPosition(position)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
Simplification\Reducers\VisualBasicEscapingReducer.vb (2)
155Dim endLineOfQuery = text.Lines.GetLineFromPosition(lastTokenOfQuery.Span.End).LineNumber 156Dim startLineOfCurrentToken = text.Lines.GetLineFromPosition(identifier.SpanStart).LineNumber
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 (17)
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (5)
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;
Shared\Extensions\SourceTextExtensions.cs (1)
37var line = text.Lines.GetLineFromPosition(position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
21var line = text.Lines.GetLineFromPosition(position);
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\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\IIndentationService.cs (2)
32var tokenLine = document.Text.Lines.GetLineFromPosition(token.SpanStart); 56var newTokenLine = newDocument.Text.Lines.GetLineFromPosition(newRoot.GetAnnotatedTokens(annotation).Single().SpanStart);
Microsoft.VisualStudio.LanguageServices (8)
FindReferences\Entries\AbstractDocumentSpanEntry.cs (1)
104var line = text.Lines.GetLineFromPosition(position);
FindReferences\Entries\DocumentSpanEntry.cs (1)
235var lineNumber = sourceText.Lines.GetLineFromPosition(referenceSpan.Start).LineNumber;
Venus\ContainedDocument.cs (5)
508var visibleFirstLineInOriginalText = originalText.Lines.GetLineFromPosition(visibleSpanInOriginalText.Start); 509var visibleLastLineInOriginalText = originalText.Lines.GetLineFromPosition(visibleSpanInOriginalText.End); 890var startingLine = text.Lines.GetLineFromPosition(span.Start); 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 (8)
CodeModel\CSharpCodeModelService.NodeLocator.cs (8)
139var openBraceLine = text.Lines.GetLineFromPosition(openBrace.Span.End); 153var openBraceLine = text.Lines.GetLineFromPosition(openBrace.SpanStart); 154var closeBraceLine = text.Lines.GetLineFromPosition(closeBrace.SpanStart); 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 (1)
Venus\DocumentService_IntegrationTests.vb (1)
327Dim line = mappedSource.Lines.GetLineFromPosition(mappedSpan.Start)
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
CodeModel\VisualBasicCodeModelService.NodeLocator.vb (2)
334Dim statementLine = text.Lines.GetLineFromPosition(statement.SpanStart) 406Dim statementLine = text.Lines.GetLineFromPosition(statement.SpanStart)