Skip to content

Commit

Permalink
Line number as a edit link
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko committed Jul 8, 2019
1 parent 177775e commit 0f31214
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ReportPortal.Extensions.SourceBack/SourceBackFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public bool FormatLog(ref AddLogItemRequest logRequest)
var frameContent = string.Join(Environment.NewLine, frameContentLines);

sectionBuilder.AppendLine($"```{Environment.NewLine}{frameContent}{Environment.NewLine}```");
sectionBuilder.AppendLine($"[Open in VisualStudioCode](vscode://file/{sourcePath.Replace("\\", "/")}:{lineIndex + 1})");
}
}
}
Expand All @@ -106,7 +105,9 @@ public bool FormatLog(ref AddLogItemRequest logRequest)

if (!string.IsNullOrEmpty(sectionBuilder.ToString()))
{
fullMessageBuilder.AppendLine($"{lineWithoutMarkdown}{Environment.NewLine}{sectionBuilder}");
var lineWithEditLink = lineWithoutMarkdown.Remove(lineWithoutMarkdown.Length - match.Groups[2].Value.Length) + $"[{lineIndex}](vscode://file/{sourcePath.Replace("\\", "/")}:{lineIndex + 1})";

fullMessageBuilder.AppendLine($"{lineWithEditLink}{Environment.NewLine}{sectionBuilder}");
}
else
{
Expand Down

0 comments on commit 0f31214

Please sign in to comment.