Skip to content

Commit

Permalink
Revert "Update LocationConverter.cs"
Browse files Browse the repository at this point in the history
This reverts commit 27a7d29.
  • Loading branch information
SimonCropp committed Sep 18, 2024
1 parent 841dd34 commit e92d2c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Verify.SourceGenerators/Converters/LocationConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class LocationConverter :
WriteOnlyJsonConverter<Location>
{
const int contextLines = 1;

public override void Write(VerifyJsonWriter writer, Location value)
{
var lineSpan = value.GetMappedLineSpan();
Expand All @@ -21,8 +23,8 @@ static void WriteSourceTree(VerifyJsonWriter writer, Location value, FileLinePos
var comment = new StringBuilder();
comment.AppendLine();
var lines = source.GetText().Lines;
var startLine = Math.Max(lineSpan.StartLinePosition.Line - 1, 0);
var endLine = Math.Min(lineSpan.EndLinePosition.Line + 1, lines.Count - 1);
var startLine = Math.Max(lineSpan.StartLinePosition.Line - contextLines, 0);
var endLine = Math.Min(lineSpan.EndLinePosition.Line + contextLines, lines.Count - 1);
for (var index = startLine; index <= endLine; index++)
{
var line = lines[index];
Expand Down

0 comments on commit e92d2c8

Please sign in to comment.