419 references to Line
Analyzer.Utilities.UnitTests (2)
FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAnalysisTests.cs (2)
115if (span.StartLinePosition.Line + 1 == Line 144int lineNumber = linePosition.Line + 1;
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\InterceptorInfo.cs (1)
184LineNumber = linePosSpan.StartLinePosition.Line + 1;
GenerateDocumentationAndConfigFiles (2)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
Metrics (5)
MetricsOutputWriter.cs (1)
87writer.WriteAttributeString("Line", (location.GetLineSpan().StartLinePosition.Line + 1).ToString(CultureInfo.InvariantCulture));
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Metrics.Legacy (5)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Tools\Metrics\MetricsOutputWriter.cs (1)
87writer.WriteAttributeString("Line", (location.GetLineSpan().StartLinePosition.Line + 1).ToString(CultureInfo.InvariantCulture));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Microsoft.Analyzers.Local.Tests (1)
InternalReferencedInPublicDocAnalyzerTests.cs (1)
469Assert.Equal(lineNumbers[i], location.GetLineSpan().StartLinePosition.Line);
Microsoft.AspNetCore.Analyzer.Testing (3)
Assert.cs (3)
17if (actualLinePosition.Line > 0) 19if (actualLinePosition.Line + 1 != expected.Line) 24$"Expected diagnostic to be on line \"{expected.Line}\" was actually on line \"{actualLinePosition.Line + 1}\"");
Microsoft.AspNetCore.Components.Analyzers.Tests (4)
Verifiers\DiagnosticVerifier.cs (4)
203if (actualLinePosition.Line > 0) 205if (actualLinePosition.Line + 1 != expected.Line) 211expected.Line, actualLinePosition.Line + 1, FormatDiagnostics(analyzer, diagnostic))); 268linePosition.Line + 1,
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (4)
Verifiers\DiagnosticVerifier.cs (4)
203if (actualLinePosition.Line > 0) 205if (actualLinePosition.Line + 1 != expected.Line) 211expected.Line, actualLinePosition.Line + 1, FormatDiagnostics(analyzer, diagnostic))); 268linePosition.Line + 1,
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
StaticRouteHandlerModel\Endpoint.cs (1)
168return (filePath, lineSpan.StartLinePosition.Line + 1, lineSpan.StartLinePosition.Character + 1);
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (2)
CompilationFailedExceptionFactory.cs (2)
124mappedLineSpan.StartLinePosition.Line + 1, 126mappedLineSpan.EndLinePosition.Line + 1,
Microsoft.CodeAnalysis (26)
CodeGen\SequencePointList.cs (4)
177int startLine = (fileLinePositionSpan.StartLinePosition.Line == -1) ? 0 : fileLinePositionSpan.StartLinePosition.Line + 1; 178int endLine = (fileLinePositionSpan.EndLinePosition.Line == -1) ? 0 : fileLinePositionSpan.EndLinePosition.Line + 1;
CommandLine\SarifErrorLogger.cs (2)
50_writer.Write("startLine", span.StartLinePosition.Line + 1); 52_writer.Write("endLine", span.EndLinePosition.Line + 1);
Diagnostic\DiagnosticFormatter.cs (1)
79return string.Format("({0},{1})", span.Start.Line + 1, span.Start.Character + 1);
Diagnostic\Location.cs (2)
115result += "(" + pos.Path + "@" + (pos.StartLinePosition.Line + 1) + ":" + (pos.StartLinePosition.Character + 1) + ")"; 144result += "(" + pos.Path + "@" + (pos.StartLinePosition.Line + 1) + ":" + (pos.StartLinePosition.Character + 1) + ")";
Syntax\LineDirectiveMap.cs (6)
53var entry = FindEntry(unmappedStartPos.Line); 73int mappedLine = unmapped.Line - entry.UnmappedLine + entry.MappedLine; 83if (unmappedStartPos.Line == entry.UnmappedLine && 96unmapped.Line - entry.UnmappedLine + entry.MappedSpan.Start.Line, 97unmapped.Line == entry.UnmappedLine ?
Syntax\SyntaxTree.cs (1)
323return GetMappedLineSpan(span).StartLinePosition.Line + 1;
Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
Text\LinePosition.cs (4)
107return other.Line == this.Line && other.Character == this.Character; 124return Hash.Combine(Line, Character); 133return Line + "," + Character;
Text\TextLineCollection.cs (4)
65if (position.Line >= this.Count) 67throw new ArgumentOutOfRangeException(nameof(position.Line), string.Format(CodeAnalysisResources.LineCannotBeGreaterThanEnd, position.Line, this.Count)); 70return this[position.Line].Start + position.Character;
Microsoft.CodeAnalysis.Analyzers (4)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Microsoft.CodeAnalysis.AnalyzerUtilities (4)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Microsoft.CodeAnalysis.BannedApiAnalyzers (4)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Microsoft.CodeAnalysis.CodeStyle (2)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (2)
77text.Lines[diagnosticLinePositionSpan.Start.Line].Start, 78text.Lines[diagnosticLinePositionSpan.End.Line].End);
Microsoft.CodeAnalysis.CSharp (11)
CommandLine\CommandLineDiagnosticFormatter.cs (3)
33span.Start.Line + 1, 35span.End.Line + 1, 41span.Start.Line + 1,
Compilation\CSharpSemanticModel.cs (1)
5296var lineNumberOneIndexed = lineSpan.Line + 1;
Emitter\Model\PEModuleBuilder.cs (2)
471span.StartLinePosition.Line, 473span.EndLinePosition.Line,
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
509span.StartLinePosition.Line, 511span.EndLinePosition.Line,
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
1308diagnostics.Add(ErrorCode.ERR_InterceptorMustReferToStartOfTokenPosition, attributeLocation, referencedToken.Text, linePositionZeroBased.Line + 1, linePositionZeroBased.Character + 1);
Syntax\CSharpLineDirectiveMap.cs (2)
192var index = FindEntryIndex(unmappedPos.Line); 246var entry = FindEntry(unmappedStartPos.Line);
Microsoft.CodeAnalysis.CSharp.Features (5)
Structure\Providers\ArgumentListStructureProvider.cs (2)
37var start = text.Lines.GetLinePosition(openToken.SpanStart).Line; 38var end = text.Lines.GetLinePosition(closeToken.SpanStart).Line;
Structure\Providers\ParameterListStructureProvider.cs (2)
37var start = text.Lines.GetLinePosition(openToken.SpanStart).Line; 38var end = text.Lines.GetLinePosition(closeToken.SpanStart).Line;
SyncedSource\FileBasedPrograms\FileLevelDirectiveHelpers.cs (1)
244return $"{Path}({Text.Lines.GetLinePositionSpan(span).Start.Line + 1})";
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\FieldInitializerBindingTests.cs (1)
282var initValueLineNumber = syntaxTree.GetLineSpan(initValueSyntax.Span).StartLinePosition.Line;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (18)
Diagnostics\LineSpanDirectiveTests.cs (2)
498if (position.Line < lines.Count) 500var line = lines[position.Line];
Diagnostics\LocationsTests.cs (14)
60Assert.Equal(expectedStartLine, mappedSpan.StartLinePosition.Line); 62Assert.Equal(expectedEndLine, mappedSpan.EndLinePosition.Line); 96Assert.Equal(2, flpsX.StartLinePosition.Line); 98Assert.Equal(2, flpsX.EndLinePosition.Line); 103Assert.Equal(19, flpsX.StartLinePosition.Line); 105Assert.Equal(19, flpsX.EndLinePosition.Line); 110Assert.Equal(2, flpsXToCloseBrace.StartLinePosition.Line); 112Assert.Equal(3, flpsXToCloseBrace.EndLinePosition.Line); 117Assert.Equal(19, flpsXToCloseBrace.StartLinePosition.Line); 119Assert.Equal(20, flpsXToCloseBrace.EndLinePosition.Line); 573Assert.Equal(0, lineSpan.StartLinePosition.Line); 575Assert.Equal(0, lineSpan.EndLinePosition.Line); 601Assert.Equal(0, lineSpan.StartLinePosition.Line); 603Assert.Equal(0, lineSpan.EndLinePosition.Line);
LexicalAndXml\PreprocessorTests.cs (1)
3561Assert.Equal(99, lineSpan.StartLinePosition.Line); // zero-based line number
Parsing\ParserRegressionTests.cs (1)
168var line = endLinePosition.Line;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
DiagnosticTestUtilities.cs (1)
119Line = lineSpan.IsValid ? lineSpan.StartLinePosition.Line + 1 : 0,
Microsoft.CodeAnalysis.EditorFeatures (5)
AutomaticCompletion\BraceCompletionSessionProvider.BraceCompletionSession.cs (1)
473var caretLine = SubjectBuffer.CurrentSnapshot.GetLineFromLineNumber(result.CaretLocation.Line);
Peek\PeekHelpers.cs (4)
20var label = string.Format("{0} - ({1}, {2})", fileName, identifierLocation.Start.Line + 1, identifierLocation.Start.Character + 1); 38startLine: entityOfInterestSpan.Start.Line, 40endLine: entityOfInterestSpan.End.Line, 42idLine: identifierLocation.Start.Line,
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
TaskList\AbstractTaskListTests.cs (1)
55Assert.Equal(todo.MappedSpan.StartLinePosition.Line, line.LineNumber);
Microsoft.CodeAnalysis.EditorFeatures.Text (2)
Shared\Extensions\ITextSnapshotExtensions.cs (2)
35GetPosition(snapshot, span.Start.Line, span.Start.Character), 36GetPosition(snapshot, span.End.Line, span.End.Character));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
EditAndContinue\EditorManagedHotReloadLanguageServiceTests.cs (2)
120(!string.IsNullOrWhiteSpace(d.DataLocation.UnmappedFileSpan.Path) ? $" {d.DataLocation.UnmappedFileSpan.Path}({d.DataLocation.UnmappedFileSpan.StartLinePosition.Line}, {d.DataLocation.UnmappedFileSpan.StartLinePosition.Character}, {d.DataLocation.UnmappedFileSpan.EndLinePosition.Line}, {d.DataLocation.UnmappedFileSpan.EndLinePosition.Character}):" : "") +
Microsoft.CodeAnalysis.Features (37)
BraceCompletion\AbstractBraceCompletionService.cs (1)
65var caretLocation = new LinePosition(originalOpeningLinePosition.Line, originalOpeningLinePosition.Character + 1);
CodeLens\CodeLensReferencesService.cs (2)
152startLinePosition.Line, 272result.LinePositionSpan.Start.Line,
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
2350var oldStartLine = oldMappedSpan.Span.Start.Line; 2351var newStartLine = newMappedSpan.Span.Start.Line;
EditAndContinue\ActiveStatementsMap.cs (12)
251var lineDifference = unmappedSection.Start.Line - mappedSection.Start.Line; 252var unmappedStartLine = mappedSpan.Start.Line + lineDifference; 253var unmappedEndLine = mappedSpan.End.Line + lineDifference; 255var unmappedStartColumn = (mappedSpan.Start.Line == mappedSection.Start.Line) 259var unmappedEndColumn = (mappedSpan.End.Line == mappedSection.Start.Line) 268if (lineSpan.Start.Line >= lines.Count || lineSpan.End.Line >= lines.Count) 274var start = lines[lineSpan.Start.Line].Start + lineSpan.Start.Character; 275var end = lines[lineSpan.End.Line].Start + lineSpan.End.Character;
EditAndContinue\EditSession.cs (8)
1760Debug.Assert(newSpan.Span.End.Line - newSpan.Span.Start.Line == baseSpan.Span.End.Line - baseSpan.Span.Start.Line); 1761Debug.Assert(region.OldSpan.Span.End.Line - region.OldSpan.Span.Start.Line == baseSpan.Span.End.Line - baseSpan.Span.Start.Line);
EditAndContinue\Utilities\Extensions.cs (6)
21=> new(new LinePosition(span.Start.Line + lineDelta, span.Start.Character), new LinePosition(span.End.Line + lineDelta, span.End.Character)); 27=> newSpan.Start.Line - oldSpan.Start.Line; 36=> new(span.Start.Line, span.Start.Character, span.End.Line, span.End.Character);
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (2)
77text.Lines[diagnosticLinePositionSpan.Start.Line].Start, 78text.Lines[diagnosticLinePositionSpan.End.Line].End);
Structure\BlockSpan.cs (4)
134var startLine = lines.GetLinePosition(this.TextSpan.Start).Line; 135var otherStartLine = lines.GetLinePosition(other.Value.TextSpan.Start).Line; 139var endLine = lines.GetLinePosition(this.TextSpan.End).Line; 140var otherEndLine = lines.GetLinePosition(other.Value.TextSpan.End).Line;
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\ActiveStatementTestHelpers.cs (1)
114=> text.Lines[span.Start.Line].ToString().Trim();
Microsoft.CodeAnalysis.Features.UnitTests (5)
EditAndContinue\ActiveStatementsMapTests.cs (1)
262], map.DocumentPathMap["a.cs"].OrderBy(s => s.Span.Start.Line).Select(s => $"{s.Span}"));
EditAndContinue\EditSessionActiveStatementsTests.cs (2)
400], nonRemappableRegions.OrderBy(r => r.Region.OldSpan.Span.Start.Line).Select(r => $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}")); 606], nonRemappableRegions.OrderBy(r => r.Region.OldSpan.Span.Start.Line).Select(r => $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}"));
EditAndContinue\RemoteEditAndContinueServiceTests.cs (2)
34(!string.IsNullOrWhiteSpace(d.DataLocation.UnmappedFileSpan.Path) ? $" {d.DataLocation.UnmappedFileSpan.Path}({d.DataLocation.UnmappedFileSpan.StartLinePosition.Line}, {d.DataLocation.UnmappedFileSpan.StartLinePosition.Character}, {d.DataLocation.UnmappedFileSpan.EndLinePosition.Line}, {d.DataLocation.UnmappedFileSpan.EndLinePosition.Character}):" : "") +
Microsoft.CodeAnalysis.LanguageServer.Protocol (13)
Extensions\ProtocolConversions.cs (2)
334linePositionSpan.End.Line == text.Lines.Count && 385=> new() { Line = linePosition.Line, Character = linePosition.Character };
Extensions\ProtocolConversions.Diagnostics.cs (2)
164Line = dataLocation.UnmappedFileSpan.StartLinePosition.Line, 169Line = dataLocation.UnmappedFileSpan.EndLinePosition.Line,
Handler\Diagnostics\DiagnosticsPullCache.cs (1)
134writer.WriteInt32(position.Line);
Handler\FoldingRanges\FoldingRangesHandler.cs (4)
104if (linePositionSpan.Start.Line == linePositionSpan.End.Line) 120StartLine = linePositionSpan.Start.Line, 122EndLine = linePositionSpan.End.Line,
Handler\OnAutoInsert\OnAutoInsertHandler.cs (3)
188var caretLine = newSourceText.Lines[desiredCaretLinePosition.Line]; 202var caretLineInIndentedText = indentedText.Lines[desiredCaretLinePosition.Line]; 208desiredCaretLinePosition = new LinePosition(desiredCaretLinePosition.Line, Math.Min(desiredCaretLinePosition.Character, caretLine.End));
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
307var lineNumber = linePosition.Line;
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
Diagnostics\AbstractPullDiagnosticTestsBase.cs (1)
227await testLspServer.InsertTextAsync(document.GetURI(), (lineInfo.Start.Line, lineInfo.Start.Character, text));
Diagnostics\PullDiagnosticTests.cs (2)
831Start = new LSP.Position(originalSpan.Start.Line, originalSpan.Start.Character), 832End = new LSP.Position(originalSpan.End.Line, originalSpan.End.Character)
SpellCheck\SpellCheckTests.cs (1)
667await testLspServer.InsertTextAsync(document.GetURI(), (lineInfo.Start.Line, lineInfo.Start.Character, text));
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (4)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Microsoft.CodeAnalysis.PublicApiAnalyzers (4)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Microsoft.CodeAnalysis.Razor.Compiler (24)
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (5)
935location.Line, 938endLocation.Line - location.Line, 948location.Line, 964location.Line,
Language\DefaultTagHelperResolutionPhase.cs (6)
854new SourceSpan(filePath, exprStart, atLoc.Line, atLoc.Character, 1, 0, atLoc.Character + 1))); 865new SourceSpan(filePath, exprStart, loc.Line, loc.Character, exprLength, 0, loc.Character + exprLength))); 886new SourceSpan(filePath, parenStart, openLoc.Line, openLoc.Character, 1, 0, openLoc.Character + 1))); 898new SourceSpan(filePath, innerStart, innerLoc.Line, innerLoc.Character, innerLen, 0, innerLoc.Character + innerLen))); 906new SourceSpan(filePath, closePos, closeLoc.Line, closeLoc.Character, 1, 0, closeLoc.Character + 1))); 923expr.Source = expressionSource.WithLineIndex(exprLoc.Line)
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (3)
1322expr.Source = new SourceSpan(exprSource.FilePath, contentStart, openLoc.Line, openLoc.Character, contentLength, 0, closeLoc.Character + 1); 1331contentLocation.Line, 1436emptySpan = new SourceSpan(nextSrc.FilePath, nextSrc.AbsoluteIndex, loc.Line, loc.Character, 0, 0, loc.Character);
Language\Legacy\RoslynCSharpTokenizer.cs (2)
592lineIndex: linePosition.Line, 605lineIndex: linePosition.Line,
Language\SourceLocation.cs (1)
44: this(filePath, absoluteIndex, linePosition.Line, linePosition.Character)
Language\SpanComputer.cs (3)
113var lineCount = endLinePosition.Line - startLinePosition.Line; 115return new SourceSpan(source.FilePath, absoluteIndex: start, startLinePosition.Line, startLinePosition.Character, length, lineCount, endLinePosition.Character);
Language\Syntax\SyntaxNodeExtensions.cs (4)
66lastLocation.Line + (endsWithLineBreak ? 1 : 0), 101lastLocation.Line + (endsWithLineBreak ? 1 : 0), 122var lineCount = endLocation.Line - location.LineIndex; 130var lineCount = endLocation.Line - location.LineIndex;
Microsoft.CodeAnalysis.Razor.Workspaces (91)
CodeActions\Razor\GenerateEventHandlerCodeActionResolver.cs (3)
66var baseIndentation = text.Lines[classLocationLineSpan.StartLinePosition.Line].GetIndentationSize(options.TabSize) + options.TabSize; 70line: classLocationLineSpan.EndLinePosition.Line, 104line: classLocationLineSpan.StartLinePosition.Line,
CodeActions\Razor\PromoteUsingCodeActionResolver.cs (1)
62insertLocation = new LinePosition(insertLocation.Line, lastLine.SpanIncludingLineBreak.Length);
CodeActions\Razor\WrapAttributesCodeActionProvider.cs (2)
51firstAttributeLine = linePositionSpan.Start.Line; 58if (linePositionSpan.Start.Line != firstAttributeLine)
DocumentMapping\AbstractDocumentMappingService.cs (7)
45if (razorRange.End.Line < razorRange.Start.Line || 46(razorRange.End.Line == razorRange.Start.Line && 168var hostDocumentLine = csharpDocument.CodeDocument.Source.Text.GetLinePosition(razorIndex).Line; 415Logger.LogWarning($"Attempted to map a range ({span.Start.Line},{span.Start.Character})-({span.End.Line},{span.End.Character}) outside of the Source (line count {sourceTextLinesCount}.) This could happen if the Roslyn and Razor LSP servers are not in sync.");
DocumentMapping\RazorEditService_Members.cs (1)
55var previousLine = sourceText.Lines[previousLinePosition.Line];
Extensions\LinePositionExtensions.cs (4)
11=> (line, character) = (linePosition.Line, linePosition.Character); 20=> new(computeNewLine(linePosition.Line), linePosition.Character); 23=> new(linePosition.Line, newCharacter); 26=> new(linePosition.Line, computeNewCharacter(linePosition.Character));
Extensions\LinePositionSpanExtensions.cs (12)
14=> (startLine, startCharacter, endLine, endCharacter) = (linePositionSpan.Start.Line, linePositionSpan.Start.Character, linePositionSpan.End.Line, linePositionSpan.End.Character); 36var overlapStart = span.Start.Line < other.Start.Line 37? other.Start.Line 38: span.Start.Line; 40var overlapEnd = span.End.Line > other.End.Line 41? other.End.Line 42: span.End.Line; 65=> span.Start.Line != span.End.Line;
Extensions\LspExtensions_LinePosition.cs (1)
11=> LspFactory.CreatePosition(linePosition.Line, linePosition.Character);
Extensions\LspFactory.cs (7)
113=> CreatePosition(linePosition.Line, linePosition.Character); 127=> CreateRange(start.Line, start.Character, end.Line, end.Character); 159=> CreateSingleLineRange(start.Line, start.Character, length); 204=> CreateTextEdit(CreateZeroWidthRange(position.Line, position.Character), newText); 235StartLine = linePositionSpan.Start.Line, 237EndLine = linePositionSpan.End.Line,
Extensions\SourceTextExtensions.cs (5)
202=> text.TryGetAbsoluteIndex(position.Line, position.Character, out absoluteIndex); 248=> text.GetRequiredAbsoluteIndex(position.Line, position.Character); 259=> text.GetTextSpan(start.Line, start.Character, end.Line, end.Character); 286=> text.TryGetSourceLocation(position.Line, position.Character, out location);
FoldingRanges\AbstractSyntaxNodeFoldingProvider.cs (2)
28StartLine = start.Line, 30EndLine = end.Line,
FoldingRanges\FoldingRangeService.cs (2)
43foldingRange.StartLine = mappedSpan.Start.Line; 45foldingRange.EndLine = mappedSpan.End.Line;
FoldingRanges\UsingsFoldingRangeProvider.cs (4)
28if (lastRange.EndLine + 1 == span.Start.Line) 30lastRange.EndLine = span.End.Line; 36if (lastRange.StartLine - 1 == span.End.Line) 38lastRange.StartLine = span.Start.Line;
Formatting\Passes\CSharpFormattingPass.CSharpDocumentGenerator.cs (3)
369var toEndOfNode = _sourceText.GetLinePosition(node.EndPosition).Line == _currentLine.LineNumber; 380_sourceText.GetLinePosition(potentialExplicitExpression.EndPosition).Line == _currentLine.LineNumber) 1113=> _sourceText.GetLinePositionSpan(span).Start.Line;
Formatting\Passes\CSharpOnTypeFormattingPass.cs (12)
173if (linePositionSpanAfterFormatting.End.Line + lineDelta < cleanedText.Lines.Count - 1) 191var startLine = Math.Min(firstLine, linePositionSpanAfterFormatting.Start.Line); 192var endLineInclusive = Math.Max(lastLine, linePositionSpanAfterFormatting.End.Line + lineDelta); 237var first = context.SourceText.Lines[linePosition.Line].GetFirstNonWhitespaceOffset(); 262firstLine = Math.Min(firstLine, range.Start.Line); 263lastLine = Math.Max(lastLine, range.End.Line); 267delta += newLineCount - (range.End.Line - range.Start.Line); 459var mappingEndLineIndex = sourceMappingRange.End.Line; 466if (!startsInCSharpContext && newLineWasAddedAtStart && sourceMappingRange.Start.Line == mappingEndLineIndex) 544return linePositionSpan.Start.Line == linePositionSpan.End.Line;
Formatting\Passes\RazorFormattingPass.cs (6)
398var openBraceLineNumber = openBraceNode.GetLinePositionSpan(source).Start.Line; 413openBraceRange.End.Line == codeRange.Start.Line && 439else if (codeRange.End.Line == closeBraceRange.Start.Line && 454var closeBraceLine = source.Text.Lines[closeBraceRange.End.Line];
Formatting\UsingDirectiveHelper.cs (6)
136var usingDirectiveLineIndex = codeDocument.Source.Text.GetLinePosition(usingDirective.Node.Span.Start).Line; 175return codeDocument.Source.Text.GetLinePosition(endIndex).Line; 246var prevLine = sourceText.GetLinePosition(usingDirectives[i - 1].Span.End).Line; 247var currentLine = sourceText.GetLinePosition(usingDirectives[i].Span.Start).Line; 295var firstDirectiveLine = sourceText.GetLinePosition(usingDirectives[0].Span.Start).Line; 310var directiveLineNumber = sourceText.GetLinePosition(directiveSpan.Start).Line;
SemanticTokens\AbstractRazorSemanticTokensInfoService.cs (5)
171ranges.Add(new SemanticRange(semanticRange.Kind, originalRange.Start.Line, originalRange.Start.Character, originalRange.End.Line, originalRange.End.Character, tokenModifiers, fromRazor: false)); 185var startLine = originalRange.Start.Line; 188previousRange.End.Line == startLine && 197previousRazorSemanticRange?.End.Line != startLine &&
SemanticTokens\SemanticRange.cs (2)
29: this(kind, start.Line, start.Character, end.Line, end.Character, modifier, fromRazor, isCSharpWhitespace: false)
SemanticTokens\SemanticTokensVisitor.cs (5)
561if (range.Start.Line != range.End.Line) 603for (var line = lineSpan.Start.Line; line <= lineSpan.End.Line; line++) 611var endChar = line == lineSpan.End.Line
Utilities\WrapWithTagHelper.cs (1)
42line: range.Start.Line,
Microsoft.CodeAnalysis.Remote.Razor (3)
Debugging\RemoteDebugInfoService.cs (2)
125while (sourceText.GetLinePosition(hostDocumentIndex).Line == hostDocumentPosition.Line)
FindAllReferences\RemoteFindAllReferencesService.cs (1)
124var fixedResultText = await FindAllReferencesHelper.GetResultTextAsync(DocumentMappingService, context.GetSolutionQueryOperations(), mappedRange.Start.Line, mappedUri.GetDocumentFilePath(), cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Microsoft.CodeAnalysis.Test.Utilities (12)
Diagnostics\CommonDiagnosticAnalyzers.cs (8)
125""startLine"": " + (expectedLineSpan.StartLinePosition.Line + 1) + @", 127""endLine"": " + (expectedLineSpan.EndLinePosition.Line + 1) + @", 202""startLine"": " + (expectedLineSpan.StartLinePosition.Line + 1) + @", 204""endLine"": " + (expectedLineSpan.EndLinePosition.Line + 1) + @", 285""startLine"": " + (expectedLineSpan.StartLinePosition.Line + 1) + @", 287""endLine"": " + (expectedLineSpan.EndLinePosition.Line + 1) + @", 343""startLine"": " + (expectedLineSpan.StartLinePosition.Line + 1) + @", 345""endLine"": " + (expectedLineSpan.EndLinePosition.Line + 1) + @",
Diagnostics\DiagnosticDescription.cs (4)
240public int LocationLine => _startPosition.Value.Line + 1; 436sb.Append((_startPosition.Value.Line + 1).ToString(System.Globalization.CultureInfo.InvariantCulture)); 658int lineDiff = x.Value.Line.CompareTo(y.Value.Line);
Microsoft.CodeAnalysis.UnitTests (7)
LinePositionTests.cs (1)
46Assert.Equal(42, lp.Line);
Text\LargeTextTests.cs (3)
175Assert.Equal(lineNumber, text.Lines.GetLinePosition(p).Line); 183Assert.Equal(lineNumber - 1, text.Lines.GetLinePosition(start - 1).Line); 191Assert.Equal(lineNumber + 1, text.Lines.GetLinePosition(nextPosition).Line);
Text\StringTextTest.cs (3)
128Assert.Equal(lineNumber, text.Lines.GetLinePosition(p).Line); 136Assert.Equal(lineNumber - 1, text.Lines.GetLinePosition(start - 1).Line); 144Assert.Equal(lineNumber + 1, text.Lines.GetLinePosition(nextPosition).Line);
Microsoft.CodeAnalysis.VisualBasic (7)
Emit\PEModuleBuilder.vb (2)
287span.StartLinePosition.Line, 289span.EndLinePosition.Line,
Errors\DiagnosticFormatter.vb (1)
19Return "(" & (span.Start.Line + 1).ToString(Globalization.CultureInfo.InvariantCulture) & ") "
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (2)
462span.StartLinePosition.Line, 464span.EndLinePosition.Line,
Syntax\VisualBasicLineDirectiveMap.vb (2)
149Dim index As Integer = FindEntryIndex(unmappedPos.Line) 213Dim index As Integer = FindEntryIndex(unmappedStartPos.Line)
Microsoft.CodeAnalysis.Workspaces (4)
Shared\Extensions\FileLinePositionSpanExtensions.cs (2)
43var startLine = span.Start.Line; 44var endLine = span.End.Line;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
FindReferencesTests.cs (1)
739var line = location.GetLineSpan().StartLinePosition.Line;
Microsoft.Gen.ComplianceReports (3)
Parser.cs (3)
126ci.SourceLine = fileLine.StartLinePosition.Line + 1; 187ci.SourceLine = fileLine.StartLinePosition.Line + 1; 223SourceLine = fileLine.StartLinePosition.Line + 1,
Microsoft.Gen.MetadataExtractor (3)
src\Generators\Microsoft.Gen.ComplianceReports\Parser.cs (3)
126ci.SourceLine = fileLine.StartLinePosition.Line + 1; 187ci.SourceLine = fileLine.StartLinePosition.Line + 1; 223SourceLine = fileLine.StartLinePosition.Line + 1,
Microsoft.Maui.Controls.BindingSourceGen (1)
BindingInvocationDescription.cs (1)
33 return new SimpleLocation(FilePath, LineSpan.Start.Line + 1, LineSpan.Start.Character + 1);
Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests (6)
RazorDiagnosticTest.cs (2)
46Assert.Equal(1, lineSpan.StartLinePosition.Line); 48Assert.Equal(1, lineSpan.EndLinePosition.Line);
RazorSourceGeneratorComponentTests.cs (4)
853Assert.Equal(expectedLine, mapped.StartLinePosition.Line); 854Assert.Equal(expectedLine, mapped.EndLinePosition.Line); 910Assert.Equal(expectedLine, mapped.StartLinePosition.Line); 911Assert.Equal(expectedLine, mapped.EndLinePosition.Line);
Microsoft.VisualStudio.LanguageServices (21)
CallHierarchy\CallHierarchyDetail.cs (4)
34EndLine = location.GetLineSpan().EndLinePosition.Line; 37StartLine = location.GetLineSpan().StartLinePosition.Line; 44var start = location.SourceTree.GetText().Lines[lineSpan.StartLinePosition.Line].Start; 45var end = location.SourceTree.GetText().Lines[lineSpan.EndLinePosition.Line].End;
CodeDefinitionWindow\VisualStudioCodeDefinitionWindowService.cs (1)
90piLine = (uint)GetItem(iItem).Position.Line;
Diagnostics\VisualStudioVenusSpanMappingService.cs (7)
104if (!TryAdjustSpanIfNeededForVenus(documentId, originalLineInfo.StartLinePosition.Line, originalLineInfo.StartLinePosition.Character, out var startLineColumn)) 107startLineColumn = new MappedSpan(originalLineInfo.StartLinePosition.Line, originalLineInfo.StartLinePosition.Character, mappedLineInfo.StartLinePosition.Line, mappedLineInfo.StartLinePosition.Character); 111if (!TryAdjustSpanIfNeededForVenus(documentId, originalLineInfo.EndLinePosition.Line, originalLineInfo.EndLinePosition.Character, out var endLineColumn)) 114endLineColumn = new MappedSpan(originalLineInfo.EndLinePosition.Line, originalLineInfo.EndLinePosition.Character, mappedLineInfo.EndLinePosition.Line, mappedLineInfo.EndLinePosition.Character); 218return TryAdjustSpanIfNeededForVenus(documentId, adjustedPosition.Line, adjustedPosition.Character, out mappedSpan);
FindReferences\Entries\AbstractDocumentSpanEntry.cs (1)
73StandardTableKeyNames.Line => mappedSpanResult.LinePositionSpan.Start.Line,
FindReferences\VisualStudioDefinitionsAndReferencesFactory.cs (4)
50var sourceLine = GetSourceLine_MustCallOnUIThread(filePath, linePosition.Line).Trim(' ', '\t'); 53var formatted = $"{filePath} - ({linePosition.Line + 1}, {linePosition.Character + 1}) : {sourceLine}"; 140linePosition.Line, linePosition.Character, 141linePosition.Line, linePosition.Character) == VSConstants.S_OK;
TaskList\ExternalErrorDiagnosticUpdateSource.cs (2)
276return new RpcContracts.Utilities.Range(startPosition.Line, startPosition.Character, endPosition.Line, endPosition.Character);
Workspace\VisualStudioDocumentNavigationService.cs (2)
307iStartLine = mappedSpanResult.LinePositionSpan.Start.Line, 309iEndLine = mappedSpanResult.LinePositionSpan.End.Line
Microsoft.VisualStudio.LanguageServices.Razor.UnitTests (20)
Cohost\CohostRoslynCodeActionTest.cs (2)
702Start = new Position(csharpPosition.Line, csharpPosition.Character), 703End = new Position(csharpPosition.Line, csharpPosition.Character)
Cohost\Formatting\FormattingTestBase.cs (2)
97var firstLine = changes.Min(e => inputText.GetLinePositionSpan(e.Span).Start.Line); 98var lastLine = changes.Max(e => inputText.GetLinePositionSpan(e.Span).End.Line);
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostFoldingRangeEndpointTest.cs (2)
383StartLine = start.Line, 385EndLine = end.Line,
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToImplementationEndpointTest.cs (2)
159var expected = input.Spans.Select(s => inputText.GetRange(s).ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray(); 160var actual = roslynLocations.Select(l => l.Range.ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray();
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Mapping\RazorEditServiceTest.cs (2)
2001csharpLinePosition.Start.Line, 2008razorLinePosition.Start.Line,
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\RazorDocumentMappingServiceTest.cs (10)
422Assert.Equal(0, originalRange.Start.Line); 424Assert.Equal(0, originalRange.End.Line); 470Assert.Equal(2, projectedPosition.Line); 496Assert.Equal(3, projectedPosition.Line); 522Assert.Equal(3, projectedPosition.Line); 569Assert.Equal(1, hostDocumentPosition.Line); 595Assert.Equal(2, hostDocumentPosition.Line); 621Assert.Equal(2, hostDocumentPosition.Line); 647Assert.Equal(2, projectedRange.Start.Line); 649Assert.Equal(2, projectedRange.End.Line);
Microsoft.VisualStudioCode.RazorExtension.UnitTests (16)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostFoldingRangeEndpointTest.cs (2)
383StartLine = start.Line, 385EndLine = end.Line,
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToImplementationEndpointTest.cs (2)
159var expected = input.Spans.Select(s => inputText.GetRange(s).ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray(); 160var actual = roslynLocations.Select(l => l.Range.ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray();
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Mapping\RazorEditServiceTest.cs (2)
2001csharpLinePosition.Start.Line, 2008razorLinePosition.Start.Line,
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\RazorDocumentMappingServiceTest.cs (10)
422Assert.Equal(0, originalRange.Start.Line); 424Assert.Equal(0, originalRange.End.Line); 470Assert.Equal(2, projectedPosition.Line); 496Assert.Equal(3, projectedPosition.Line); 522Assert.Equal(3, projectedPosition.Line); 569Assert.Equal(1, hostDocumentPosition.Line); 595Assert.Equal(2, hostDocumentPosition.Line); 621Assert.Equal(2, hostDocumentPosition.Line); 647Assert.Equal(2, projectedRange.Start.Line); 649Assert.Equal(2, projectedRange.End.Line);
Roslyn.Diagnostics.Analyzers (4)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;
Test.Utilities (2)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
Text.Analyzers (4)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
77var line = text.Lines[position.Line]; 79message = $"Unexpected difference at offset {index}: Line {position.Line + 1}, Column {position.Character + 1} \"{line.ToString()}\" (Found: [{found}] Expected: [{expected}])";
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (2)
81long delta = linePosition.EndLinePosition.Line - linePosition.StartLinePosition.Line;