294 instantiations of LinePosition
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (6)
CompilerFailedExceptionFactoryTest.cs (6)
243new LinePositionSpan(new LinePosition(10, 1), new LinePosition(10, 2)))),
249new LinePositionSpan(new LinePosition(1, 2), new LinePosition(3, 4)))),
255new LinePositionSpan(new LinePosition(30, 5), new LinePosition(40, 12)))),
Microsoft.CodeAnalysis (10)
Microsoft.CodeAnalysis.CSharp (1)
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (12)
EditAndContinue\ActiveStatementTrackingServiceTests.cs (8)
33var span11 = new LinePositionSpan(new LinePosition(0, 10), new LinePosition(0, 15));
34var span12 = new LinePositionSpan(new LinePosition(0, 20), new LinePosition(0, 25));
35var span21 = new LinePositionSpan(new LinePosition(0, 11), new LinePosition(0, 16));
36var span22 = new LinePositionSpan(new LinePosition(0, 21), new LinePosition(0, 26));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (16)
Diagnostics\LocationsTests.cs (16)
316Assert.Equal(flps, new FileLinePositionSpan("c:\\goo.cs", new LinePosition(8, 13), new LinePosition(8, 13)));
334Assert.Equal(flps, new FileLinePositionSpan("c:\\goo.cs", new LinePosition(8, 13), new LinePosition(8, 13)));
354Assert.Equal(flps, new FileLinePositionSpan("c:\\goo.cs", new LinePosition(8, 13), new LinePosition(8, 13)));
379Assert.Equal(flps, new FileLinePositionSpan("c:\\goo.cs", new LinePosition(8, 15), new LinePosition(8, 19)));
419Assert.Equal(span, new FileLinePositionSpan("", new LinePosition(1, 9), new LinePosition(1, 9)));
504Location location = Location.Create("test.txt", new TextSpan(), new LinePositionSpan(new LinePosition(2, 1), new LinePosition(3, 1)));
515var lineSpan = new LinePositionSpan(new LinePosition(2, 1), new LinePosition(3, 1));
517var mappedLineSpan = new LinePositionSpan(new LinePosition(3, 2), new LinePosition(4, 2));
Microsoft.CodeAnalysis.EditorFeatures (3)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2 (1)
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (9)
Diagnostics\DiagnosticDataTests.cs (7)
125location: new DiagnosticDataLocation(new("originalFile1", new(startLine, startColumn), new(endLine, endColumn)), document.Id),
145new(additionalDocument.Name, new(0, 0), new(0, 1)), additionalDocument.Id);
191new(document.FilePath, new(3, 10), new(3, 11)), documentId);
239new(secondDocument.Name, new(0, 0), new(0, 1)), secondDocument.Id);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (5)
Diagnostics\DiagnosticProviderTests.vb (4)
358New FileLinePositionSpan(originalFile, New LinePosition(originalLine, originalColumn), New LinePosition(originalLine, originalColumn)),
360If(mappedFile Is Nothing, Nothing, New FileLinePositionSpan(mappedFile, New LinePosition(mappedLine, mappedColumn), New LinePosition(mappedLine, mappedColumn)))),
Microsoft.CodeAnalysis.Features (6)
Microsoft.CodeAnalysis.Features.UnitTests (50)
EditAndContinue\ActiveStatementsMapTests.cs (30)
33var span = new LinePositionSpan(new(sl, sc), new(el, ec));
35new LinePositionSpan(new(3, 0), new(3, 1)),
36new LinePositionSpan(new(3, 5), new(3, 6)),
37new LinePositionSpan(new(4, 4), new(4, 18)),
38new LinePositionSpan(new(5, 1), new(5, 2)),
39new LinePositionSpan(new(5, 2), new(5, 8)),
40new LinePositionSpan(new(19, 0), new(19, 42)));
68var span = new LinePositionSpan(new(sl, sc), new(el, ec));
70new LinePositionSpan(new(5, 1), new(5, 2)),
71new LinePositionSpan(new(5, 1), new(5, 8)),
72new LinePositionSpan(new(6, 4), new(6, 18)));
81var span = new LinePositionSpan(new(sl, sc), new(el, ec));
83new LinePositionSpan(new(5, 1), new(5, 2)),
84new LinePositionSpan(new(5, 1), new(5, 3)),
85new LinePositionSpan(new(5, 1), new(5, 8)));
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (14)
431var activeLineSpan = new LinePositionSpan(new(0, 0), new(0, 1));
4034new ActiveStatementSpan(new ActiveStatementId(0), new LinePositionSpan(new(4, 41), new(4, 42)), ActiveStatementFlags.MethodUpToDate | ActiveStatementFlags.LeafFrame),
4131var expectedSpanG1 = new LinePositionSpan(new LinePosition(3, 41), new LinePosition(3, 42));
4132var expectedSpanF1 = new LinePositionSpan(new LinePosition(8, 14), new LinePosition(8, 18));
4144var expectedSpanG2 = new LinePositionSpan(new LinePosition(3, 41), new LinePosition(3, 42));
4145var expectedSpanF2 = new LinePositionSpan(new LinePosition(9, 14), new LinePosition(9, 18));
4242var expectedSpanG1 = new LinePositionSpan(new LinePosition(3, 41), new LinePosition(3, 42));
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (16)
SemanticTokens\SemanticTokensRangeTests.cs (12)
124new LinePositionSpan(new LinePosition(12, 0), new LinePosition(13, 0)),
125new LinePositionSpan(new LinePosition(29, 0), new LinePosition(30, 0)),
181ImmutableArray<LinePositionSpan> spans = [new LinePositionSpan(new LinePosition(1, 0), new LinePosition(2, 0))];
231ImmutableArray<LinePositionSpan> spans = [new LinePositionSpan(new LinePosition(0, 0), new LinePosition(4, 0))];
290ImmutableArray<LinePositionSpan> spans = [new LinePositionSpan(new LinePosition(0, 0), new LinePosition(9, 0))];
371ImmutableArray<LinePositionSpan> spans = [new LinePositionSpan(new LinePosition(0, 0), new LinePosition(9, 0))];
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\DiagnosticDescription.cs (1)
225return new DiagnosticDescription(_code, _isWarningAsError, _squiggledText, _arguments, new LinePosition(line - 1, column - 1), _syntaxPredicate, _argumentOrderDoesNotMatter, _errorCodeType, _defaultSeverityOpt, _effectiveSeverityOpt, _isSuppressed);
Microsoft.CodeAnalysis.UnitTests (129)
FileLinePositionSpanTests.cs (40)
22EqualityUnit.Create(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5)))
23.WithNotEqualValues(new FileLinePositionSpan("C:\\Goo.cs", new LinePosition(1, 2), new LinePosition(3, 5))),
24EqualityUnit.Create(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5)))
25.WithNotEqualValues(new FileLinePositionSpan("C:\\bar.cs", new LinePosition(1, 2), new LinePosition(3, 5))),
26EqualityUnit.Create(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5)))
27.WithNotEqualValues(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 4), new LinePosition(3, 5))),
28EqualityUnit.Create(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5)))
29.WithNotEqualValues(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(4, 5))));
38var notUsed = new FileLinePositionSpan(null, new LinePosition(1, 2), new LinePosition(3, 5));
44var notUsed = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(3, 2), new LinePosition(2, 4));
50var notUsed = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(1, 1));
64var hash1 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5)).GetHashCode();
65var hash2 = new FileLinePositionSpan("C:\\goo1.cs", new LinePosition(1, 2), new LinePosition(3, 5)).GetHashCode();
66var hash3 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 3), new LinePosition(3, 5)).GetHashCode();
67var hash4 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(6, 5)).GetHashCode();
68var hash5 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(2, 2), new LinePosition(6, 5)).GetHashCode();
69var hash6 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(2, 2), new LinePosition(6, 8)).GetHashCode();
83Assert.Equal("C:\\goo.cs: (1,2)-(3,5)", new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5)).ToString());
84Assert.Equal("\\server\\goo.vb: (1,2)-(3,5)", new FileLinePositionSpan("\\server\\goo.vb", new LinePosition(1, 2), new LinePosition(3, 5)).ToString());
85Assert.Equal("~\\goo.huh: (1,2)-(3,5)", new FileLinePositionSpan("~\\goo.huh", new LinePosition(1, 2), new LinePosition(3, 5)).ToString());
LineMappingTests.cs (48)
19new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), hasMappedPath: false)),
20new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), hasMappedPath: true)),
21new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 2)), hasMappedPath: false)),
22new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(2, 2)), hasMappedPath: false)),
23new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 1), new LinePosition(1, 1)), hasMappedPath: false)),
24new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(1, 0), new LinePosition(1, 1)), hasMappedPath: false)),
25new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), null, new FileLinePositionSpan("file.cs", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), hasMappedPath: false)),
26new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), 0, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), hasMappedPath: false)),
27new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 2)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), hasMappedPath: false)),
28new LineMapping(new LinePositionSpan(new LinePosition(0, 0), new LinePosition(2, 2)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), hasMappedPath: false)),
29new LineMapping(new LinePositionSpan(new LinePosition(0, 1), new LinePosition(1, 1)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), hasMappedPath: false)),
30new LineMapping(new LinePositionSpan(new LinePosition(1, 0), new LinePosition(1, 1)), null, new FileLinePositionSpan("", new LinePositionSpan(new LinePosition(0, 0), new LinePosition(1, 1)), hasMappedPath: false)),
LinePositionTests.cs (41)
22EqualityUnit.Create(new LinePosition(1, 2)).WithEqualValues(new LinePosition(1, 2)),
23EqualityUnit.Create(new LinePosition()).WithEqualValues(new LinePosition()),
24EqualityUnit.Create(new LinePosition(1, 2)).WithNotEqualValues(new LinePosition(1, 3)),
25EqualityUnit.Create(new LinePosition(1, 2)).WithNotEqualValues(new LinePosition(2, 2)));
32() => { var notUsed = new LinePosition(-1, 42); });
39() => { var notUsed = new LinePosition(42, -1); });
45var lp = new LinePosition(42, 13);
60var hash1 = new LinePosition(1, 1).GetHashCode();
61var hash2 = new LinePosition(2, 2).GetHashCode();
62var hash3 = new LinePosition(1, 2).GetHashCode();
63var hash4 = new LinePosition(2, 1).GetHashCode();
78Assert.Equal(0, new LinePosition(1, 1).CompareTo(new LinePosition(1, 1)));
80Assert.Equal(-1, Math.Sign(new LinePosition(1, 1).CompareTo(new LinePosition(1, 2))));
81Assert.True(new LinePosition(1, 1) < new LinePosition(1, 2));
83Assert.Equal(-1, Math.Sign(new LinePosition(1, 2).CompareTo(new LinePosition(2, 1))));
84Assert.True(new LinePosition(1, 2) < new LinePosition(2, 1));
85Assert.True(new LinePosition(1, 2) <= new LinePosition(1, 2));
86Assert.True(new LinePosition(1, 2) <= new LinePosition(2, 1));
88Assert.Equal(+1, Math.Sign(new LinePosition(1, 2).CompareTo(new LinePosition(1, 1))));
89Assert.True(new LinePosition(1, 2) > new LinePosition(1, 1));
91Assert.Equal(+1, Math.Sign(new LinePosition(2, 1).CompareTo(new LinePosition(1, 2))));
92Assert.True(new LinePosition(2, 1) > new LinePosition(1, 2));
93Assert.True(new LinePosition(2, 1) >= new LinePosition(2, 1));
94Assert.True(new LinePosition(2, 1) >= new LinePosition(1, 2));
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (2)
Microsoft.CodeAnalysis.Workspaces (2)
Microsoft.VisualStudio.LanguageServices (11)
Microsoft.VisualStudio.LanguageServices.UnitTests (4)
Venus\DocumentService_IntegrationTests.vb (2)
109actual.Add((DirectCast(name, String), New LinePosition(CType(line, Integer), CType(position, Integer)), DirectCast(content, String)))
160actual.Add((result.FilePath, New LinePosition(result.LineNumber, result.ColumnNumber), result.ReferenceLineText))
179 references to LinePosition
Microsoft.AspNetCore.Analyzer.Testing (1)
Microsoft.AspNetCore.Components.Analyzers.Tests (2)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (2)
Microsoft.CodeAnalysis (59)
Microsoft.CodeAnalysis.CodeStyle (1)
Microsoft.CodeAnalysis.CSharp (8)
Microsoft.CodeAnalysis.CSharp.Features (4)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (2)
Microsoft.CodeAnalysis.EditorFeatures (2)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2 (4)
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Microsoft.CodeAnalysis.ExternalAccess.Razor (11)
Microsoft.CodeAnalysis.Features (11)
Microsoft.CodeAnalysis.Features.Test.Utilities (3)
Microsoft.CodeAnalysis.LanguageServer.Protocol (28)
Microsoft.CodeAnalysis.Test.Utilities (10)
Microsoft.CodeAnalysis.UnitTests (5)
Microsoft.CodeAnalysis.VisualBasic (2)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces (3)
Microsoft.VisualStudio.LanguageServices (14)
Diagnostics\VisualStudioVenusSpanMappingService.cs (8)
125private static LinePositionSpan GetLinePositionSpan(LinePosition position1, LinePosition position2)
135public static LinePosition GetAdjustedLineColumn(DocumentId documentId, int originalLine, int originalColumn, int mappedLine, int mappedColumn)
215if (TryFixUpNearestVisibleSpan(bufferCoordinator, nearestVisibleSpanOnSecondaryBuffer.iStartLine, nearestVisibleSpanOnSecondaryBuffer.iStartIndex, out var adjustedPosition))
227int originalLine, int originalColumn, out LinePosition adjustedPosition)
247adjustedPosition = LinePosition.Zero;
281public LinePosition OriginalLinePosition
286public LinePosition MappedLinePosition
Microsoft.VisualStudio.LanguageServices.UnitTests (2)