diff --git a/FineCodeCoverageTests/FCCEngine_Tests.cs b/FineCodeCoverageTests/FCCEngine_Tests.cs index 4f4b8d93..05ff6b0b 100644 --- a/FineCodeCoverageTests/FCCEngine_Tests.cs +++ b/FineCodeCoverageTests/FCCEngine_Tests.cs @@ -333,7 +333,7 @@ private void VerifyLogsReloadCoverageStatus(ReloadCoverageStatus reloadCoverageS mocker.Verify(l => l.Log(fccEngine.GetLogReloadCoverageStatusMessage(reloadCoverageStatus))); } - private async Task<(string reportGeneratedHtmlContent, List updatedCoverageLines)> RunToCompletion(bool noCoverageProjects) + private async Task<(string reportGeneratedHtmlContent, FileLineCoverage updatedCoverageLines)> RunToCompletion(bool noCoverageProjects) { var coverageProject = CreateSuitableProject().Object; var mockReportGenerator = mocker.GetMock(); @@ -352,7 +352,9 @@ private void VerifyLogsReloadCoverageStatus(ReloadCoverageStatus reloadCoverageS var reportGeneratedHtmlContent = ""; mockReportGenerator.Setup(rg => rg.ProcessUnifiedHtml("Unified", It.IsAny())).Returns(reportGeneratedHtmlContent); - List coverageLines = new List() { new CoverageLine() }; + var coverageLines = new FileLineCoverage(); + coverageLines.Add("test", new[] { new Line() }); + coverageLines.Completed(); mocker.GetMock().Setup(coberturaUtil => coberturaUtil.ProcessCoberturaXml(It.IsAny())).Returns(coverageLines); if (noCoverageProjects) { @@ -384,8 +386,9 @@ private async Task ThrowReadingReportHtml() } ); - - List coverageLines = new List() { new CoverageLine() }; + var coverageLines = new FileLineCoverage(); + coverageLines.Add("test", new[] { new Line() }); + coverageLines.Completed(); mocker.GetMock().Setup(coberturaUtil => coberturaUtil.ProcessCoberturaXml(It.IsAny())).Returns(coverageLines); await ReloadInitializedCoverage(passedProject.Object); diff --git a/FineCodeCoverageTests/FileLineCoverage_Tests.cs b/FineCodeCoverageTests/FileLineCoverage_Tests.cs new file mode 100644 index 00000000..7e8d087f --- /dev/null +++ b/FineCodeCoverageTests/FileLineCoverage_Tests.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using FineCodeCoverage.Engine.Model; +using NUnit.Framework; + +namespace FineCodeCoverageTests +{ + internal class FileLineCoverage_Tests + { + [TestCaseSource(nameof(Cases))] + public void GetLines_Test(IEnumerable lineNumbers, int startLineNumber, int endLineNumber, IEnumerable expectedLineNumbers) + { + var fileLineCoverage = new FileLineCoverage(); + fileLineCoverage.Add("fp", lineNumbers.Select(n => new FineCodeCoverage.Engine.Cobertura.Line { Number = n })); + fileLineCoverage.Completed(); + + var lines = fileLineCoverage.GetLines("fp", startLineNumber, endLineNumber); + Assert.That(lines.Select(l => l.Number), Is.EqualTo(expectedLineNumbers)); + } + + static object[] Cases = + { + new object[] { new int[] { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}, 19, 20, new int[]{ 19,20} }, + new object[] { new int[] { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}, 12, 13, new int[]{ 12,13} }, + new object[] { new int[] { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}, 6, 7, new int[]{ 6,7} }, + new object[] {Enumerable.Empty(), 0, 4,Enumerable.Empty() }, + new object[] { new int[] { 3,2,1}, 0, 4, new int[]{ 1,2,3} }, + new object[] { new int[] { 3,2,1}, 0, 3, new int[]{ 1,2,3} }, + new object[] { new int[] { 3,2,1}, 1, 2, new int[]{ 1,2} }, + new object[] { new int[] { 3,2,1}, 2, 2, new int[]{ 2} }, + new object[] { new int[] { 3,2,1}, 4, 5, Enumerable.Empty() } + }; + } +} diff --git a/FineCodeCoverageTests/FineCodeCoverageTests.csproj b/FineCodeCoverageTests/FineCodeCoverageTests.csproj index e53287c4..cf0c76b4 100644 --- a/FineCodeCoverageTests/FineCodeCoverageTests.csproj +++ b/FineCodeCoverageTests/FineCodeCoverageTests.csproj @@ -114,6 +114,7 @@ + diff --git a/SharedProject/Core/Cobertura/CoberturaUtil.cs b/SharedProject/Core/Cobertura/CoberturaUtil.cs index 0425a2d1..6c162f2b 100644 --- a/SharedProject/Core/Cobertura/CoberturaUtil.cs +++ b/SharedProject/Core/Cobertura/CoberturaUtil.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using FineCodeCoverage.Engine.Model; using System.ComponentModel.Composition; -using System.IO; namespace FineCodeCoverage.Engine.Cobertura { @@ -25,51 +24,9 @@ private CoverageReport LoadReport(string xmlFile) } } - //private void CoverageXmlFileToJsonFile(string xmlFile, string jsonFile, bool formattedJson = false) - //{ - // var xmlText = File.ReadAllText(xmlFile); - // var jsonText = CoverageXmlTextToJsonText(xmlText, formattedJson); - // File.WriteAllText(jsonFile, jsonText); - //} - - //private string CoverageXmlTextToJsonText(string xmlText, bool formattedJson = false) - //{ - // long count = 0; - - // var xmlLines = xmlText - // .Split('\r', '\n') - // .Select(x => x.Trim()) - // .Where(x => !x.StartsWith(" !x.StartsWith(" !x.StartsWith("") && !x.StartsWith("") && !x.StartsWith("")) - // .Where(x => !x.StartsWith("") && !x.StartsWith("")) - // .Where(x => !x.StartsWith("") && !x.StartsWith("")) - // .Where(x => !x.StartsWith("") && !x.StartsWith("")) - // .Where(x => !x.StartsWith("") && !x.StartsWith("")) - // .Select(x => x - // .Replace("", "") - // .Replace("", "") - // .Replace("", "") - // .Replace("", "") - // ); - - // var processedXmlText = string - // .Join(Environment.NewLine, xmlLines) - // .Replace(" ProcessCoberturaXml(string xmlFile) + public FileLineCoverage ProcessCoberturaXml(string xmlFile) { - var coverageLines = new List(); + var fileLineCoverage = new FileLineCoverage(); coverageReport = LoadReport(xmlFile); @@ -77,19 +34,12 @@ public List ProcessCoberturaXml(string xmlFile) { foreach (var classs in package.Classes.Class) { - foreach (var line in classs.Lines.Line) - { - coverageLines.Add(new CoverageLine - { - Package = package, - Class = classs, - Line = line - }); - } + fileLineCoverage.Add(classs.Filename, classs.Lines.Line); } } - return coverageLines; + fileLineCoverage.Completed(); + return fileLineCoverage; } public string[] GetSourceFiles(string assemblyName, string qualifiedClassName, int file) diff --git a/SharedProject/Core/Cobertura/ICoberturaUtil.cs b/SharedProject/Core/Cobertura/ICoberturaUtil.cs index ab91f313..41b1717a 100644 --- a/SharedProject/Core/Cobertura/ICoberturaUtil.cs +++ b/SharedProject/Core/Cobertura/ICoberturaUtil.cs @@ -5,7 +5,7 @@ namespace FineCodeCoverage.Engine.Cobertura { interface ICoberturaUtil { - List ProcessCoberturaXml(string xmlFile); + FileLineCoverage ProcessCoberturaXml(string xmlFile); string[] GetSourceFiles(string assemblyName, string qualifiedClassName, int file); } } \ No newline at end of file diff --git a/SharedProject/Core/FCCEngine.cs b/SharedProject/Core/FCCEngine.cs index c175b865..01cd8f4c 100644 --- a/SharedProject/Core/FCCEngine.cs +++ b/SharedProject/Core/FCCEngine.cs @@ -19,7 +19,7 @@ internal enum ReloadCoverageStatus { Start, Done, Cancelled, Error, Initializing internal class NewCoverageLinesMessage { - public List CoverageLines { get; set; } + public FileLineCoverage CoverageLines { get; set; } } internal class DisplayCoverageResultState @@ -202,12 +202,12 @@ private void ClearCoverageLines() RaiseCoverageLines(null); } - private void RaiseCoverageLines(List coverageLines) + private void RaiseCoverageLines(FileLineCoverage coverageLines) { eventAggregator.SendMessage(new NewCoverageLinesMessage { CoverageLines = coverageLines}); } - private void UpdateUI(List coverageLines, string reportHtml) + private void UpdateUI(FileLineCoverage coverageLines, string reportHtml) { RaiseCoverageLines(coverageLines); if (reportHtml == null) @@ -217,7 +217,7 @@ private void UpdateUI(List coverageLines, string reportHtml) RaiseUpdateOutputWindow(reportHtml); } - private async System.Threading.Tasks.Task<(List coverageLines,string reportFilePath)> RunAndProcessReportAsync(string[] coverOutputFiles, CancellationToken vsShutdownLinkedCancellationToken) + private async System.Threading.Tasks.Task<(FileLineCoverage coverageLines,string reportFilePath)> RunAndProcessReportAsync(string[] coverOutputFiles, CancellationToken vsShutdownLinkedCancellationToken) { var reportOutputFolder = coverageOutputManager.GetReportOutputFolder(); vsShutdownLinkedCancellationToken.ThrowIfCancellationRequested(); @@ -262,7 +262,7 @@ private async System.Threading.Tasks.Task PrepareCoverageProjectsAsync(List coverageLines, string reportHtml)> t, object state) + private void DisplayCoverageResult(System.Threading.Tasks.Task<(FileLineCoverage coverageLines, string reportHtml)> t, object state) { var displayCoverageResultState = (DisplayCoverageResultState)state; if (!IsVsShutdown) @@ -321,7 +321,7 @@ public void RunAndProcessReport(string[] coberturaFiles, Action cleanUp = null) { RunCancellableCoverageTask(async (vsShutdownLinkedCancellationToken) => { - List coverageLines = null; + FileLineCoverage coverageLines = null; string reportHtml = null; if (coberturaFiles.Any()) @@ -333,7 +333,7 @@ public void RunAndProcessReport(string[] coberturaFiles, Action cleanUp = null) } private void RunCancellableCoverageTask( - Func, string)>> taskCreator, Action cleanUp) + Func> taskCreator, Action cleanUp) { var vsLinkedCancellationTokenSource = Reset(); var vsShutdownLinkedCancellationToken = vsLinkedCancellationTokenSource.Token; @@ -355,7 +355,7 @@ public void ReloadCoverage(Func { - List coverageLines = null; + FileLineCoverage coverageLines = null; string reportHtml = null; await PollInitializedStatusAsync(vsShutdownLinkedCancellationToken); diff --git a/SharedProject/Core/Model/CoverageLine.cs b/SharedProject/Core/Model/CoverageLine.cs deleted file mode 100644 index 3df41b74..00000000 --- a/SharedProject/Core/Model/CoverageLine.cs +++ /dev/null @@ -1,11 +0,0 @@ -using FineCodeCoverage.Engine.Cobertura; - -namespace FineCodeCoverage.Engine.Model -{ - internal class CoverageLine - { - public Package Package { get; internal set; } - public Class Class { get; internal set; } - public Line Line { get; internal set; } - } -} diff --git a/SharedProject/Core/Model/FileLineCoverage.cs b/SharedProject/Core/Model/FileLineCoverage.cs new file mode 100644 index 00000000..f7e409d7 --- /dev/null +++ b/SharedProject/Core/Model/FileLineCoverage.cs @@ -0,0 +1,46 @@ +using FineCodeCoverage.Core.Utilities; +using FineCodeCoverage.Engine.Cobertura; +using System; +using System.Collections.Generic; + +namespace FineCodeCoverage.Engine.Model +{ + // FileLineCoverage maps from a filename to the list of lines in the file + internal class FileLineCoverage + { + private Dictionary> m_coverageLines = new Dictionary>(StringComparer.OrdinalIgnoreCase); + + public void Add(string filename, IEnumerable lines) + { + if (!m_coverageLines.TryGetValue(filename, out var fileCoverageLines)) + { + fileCoverageLines = new List(); + m_coverageLines.Add(filename, fileCoverageLines); + } + + fileCoverageLines.AddRange(lines); + } + + public void Completed() + { + foreach (var lines in m_coverageLines.Values) + lines.Sort((a, b) => a.Number - b.Number); + } + + public IEnumerable GetLines(string filePath, int startLineNumber, int endLineNumber) + { + if (!m_coverageLines.TryGetValue(filePath, out var lines)) + yield break; + + int first = lines.LowerBound(line => startLineNumber - line.Number); + if (first != -1) + { + for (int it = first; it < lines.Count && lines[it].Number <= endLineNumber; ++it) + yield return lines[it]; + } + + } + } + + +} diff --git a/SharedProject/Core/Utilities/ListExtensions.cs b/SharedProject/Core/Utilities/ListExtensions.cs new file mode 100644 index 00000000..04977eab --- /dev/null +++ b/SharedProject/Core/Utilities/ListExtensions.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; + +namespace FineCodeCoverage.Core.Utilities +{ + public static class ListExtensions + { + // To be performed on a sorted list + // Returns -1 for empty list or when all elements are outside the lower bounds + // Compare fn to return 0 for element considered the lower bound + // > 0 for lower bound greater than element + + public static int LowerBound(this IList list, Func compare) + { + int first = 0; + int count = list.Count; + if (count == 0) return -1; + + while (count > 0) + { + int step = count / 2; + int index = first + step; + var result = compare(list[index]); + if (result == 0) + { + return index; + } + else if (result > 0) + { + first = ++index; + count -= step + 1; + } + else + { + count = step; + } + } + + return first != list.Count ? first : -1; + } + } +} diff --git a/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTag.cs b/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTag.cs index 3236ff06..5ca9d8a7 100644 --- a/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTag.cs +++ b/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTag.cs @@ -1,13 +1,14 @@ -using FineCodeCoverage.Engine.Model; +using FineCodeCoverage.Engine.Cobertura; +using FineCodeCoverage.Engine.Model; using Microsoft.VisualStudio.Text.Editor; namespace FineCodeCoverage.Impl { internal class CoverageLineGlyphTag : IGlyphTag { - public CoverageLine CoverageLine { get; } + public Line CoverageLine { get; } - public CoverageLineGlyphTag(CoverageLine coverageLine) + public CoverageLineGlyphTag(Line coverageLine) { CoverageLine = coverageLine; } diff --git a/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTagger.cs b/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTagger.cs index a55ad8f1..88ec3098 100644 --- a/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTagger.cs +++ b/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTagger.cs @@ -8,7 +8,7 @@ namespace FineCodeCoverage.Impl { internal class CoverageLineGlyphTagger : CoverageLineTaggerBase, IListener { - public CoverageLineGlyphTagger(ITextBuffer textBuffer, List lastCoverageLines) : base(textBuffer, lastCoverageLines) + public CoverageLineGlyphTagger(ITextBuffer textBuffer, FileLineCoverage lastCoverageLines) : base(textBuffer, lastCoverageLines) { } @@ -17,7 +17,7 @@ public void Handle(RefreshCoverageGlyphsMessage message) RaiseTagsChanged(); } - protected override TagSpan GetTagSpan(CoverageLine coverageLine, SnapshotSpan span) + protected override TagSpan GetTagSpan(Engine.Cobertura.Line coverageLine, SnapshotSpan span) { return new TagSpan(span, new CoverageLineGlyphTag(coverageLine)); } diff --git a/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTaggerProvider.cs b/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTaggerProvider.cs index a93d08f3..3a48ec35 100644 --- a/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTaggerProvider.cs +++ b/SharedProject/Impl/CoverageColour/GlyphMargin/CoverageLineGlyphTaggerProvider.cs @@ -41,7 +41,7 @@ protected override void NewCoverageLinesMessageReceived() }); } - protected override CoverageLineGlyphTagger CreateTagger(ITextBuffer textBuffer, List lastCoverageLines) + protected override CoverageLineGlyphTagger CreateTagger(ITextBuffer textBuffer, FileLineCoverage lastCoverageLines) { return new CoverageLineGlyphTagger(textBuffer, lastCoverageLines); } diff --git a/SharedProject/Impl/CoverageColour/MarginBase/CoverageLineTaggerBase.cs b/SharedProject/Impl/CoverageColour/MarginBase/CoverageLineTaggerBase.cs index ada808d2..638854f5 100644 --- a/SharedProject/Impl/CoverageColour/MarginBase/CoverageLineTaggerBase.cs +++ b/SharedProject/Impl/CoverageColour/MarginBase/CoverageLineTaggerBase.cs @@ -11,11 +11,11 @@ namespace FineCodeCoverage.Impl internal abstract class CoverageLineTaggerBase : ICoverageLineTagger where TTag : ITag { private readonly ITextBuffer _textBuffer; - private List coverageLines; + private FileLineCoverage coverageLines; public event EventHandler TagsChanged; - public CoverageLineTaggerBase(ITextBuffer textBuffer, List lastCoverageLines) + public CoverageLineTaggerBase(ITextBuffer textBuffer, FileLineCoverage lastCoverageLines) { _textBuffer = textBuffer; coverageLines = lastCoverageLines; @@ -32,14 +32,8 @@ protected virtual void RaiseTagsChanged() TagsChanged?.Invoke(this, spanEventArgs); } - private IEnumerable GetApplicableLines(string filePath, int startLineNumber, int endLineNumber) - { - return coverageLines - .AsParallel() - .Where(x => x.Class.Filename.Equals(filePath, StringComparison.OrdinalIgnoreCase)) - .Where(x => x.Line.Number >= startLineNumber && x.Line.Number <= endLineNumber) - .ToArray(); - } + private IEnumerable GetApplicableLines(string filePath, int startLineNumber, int endLineNumber) + => coverageLines.GetLines(filePath, startLineNumber, endLineNumber); public void Handle(NewCoverageLinesMessage message) { @@ -85,6 +79,6 @@ protected virtual void AddTags(NormalizedSnapshotSpanCollection spans, List GetTagSpan(CoverageLine coverageLine, SnapshotSpan span); + protected abstract TagSpan GetTagSpan(Engine.Cobertura.Line coverageLine, SnapshotSpan span); } } diff --git a/SharedProject/Impl/CoverageColour/MarginBase/CoverageLineTaggerProviderBase.cs b/SharedProject/Impl/CoverageColour/MarginBase/CoverageLineTaggerProviderBase.cs index 21ae4be8..33ed9f91 100644 --- a/SharedProject/Impl/CoverageColour/MarginBase/CoverageLineTaggerProviderBase.cs +++ b/SharedProject/Impl/CoverageColour/MarginBase/CoverageLineTaggerProviderBase.cs @@ -12,7 +12,7 @@ internal abstract class CoverageLineTaggerProviderBase : where TTag : ITag { protected readonly IEventAggregator eventAggregator; - private List lastCoverageLines; + private FileLineCoverage lastCoverageLines; public CoverageLineTaggerProviderBase( IEventAggregator eventAggregator @@ -29,7 +29,7 @@ public ITagger CreateTagger(ITextBuffer textBuffer) where T : ITag return tagger as ITagger; } - protected abstract TTaggerListener CreateTagger(ITextBuffer textBuffer, List lastCoverageLines); + protected abstract TTaggerListener CreateTagger(ITextBuffer textBuffer, FileLineCoverage lastCoverageLines); public void Handle(NewCoverageLinesMessage message) { diff --git a/SharedProject/Impl/CoverageColour/OverviewMargin/CoverageLineMarkTagger.cs b/SharedProject/Impl/CoverageColour/OverviewMargin/CoverageLineMarkTagger.cs index 8508b1b0..93fd70d0 100644 --- a/SharedProject/Impl/CoverageColour/OverviewMargin/CoverageLineMarkTagger.cs +++ b/SharedProject/Impl/CoverageColour/OverviewMargin/CoverageLineMarkTagger.cs @@ -1,4 +1,5 @@ using FineCodeCoverage.Core.Utilities; +using FineCodeCoverage.Engine.Cobertura; using FineCodeCoverage.Engine.Model; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Tagging; @@ -9,7 +10,7 @@ namespace FineCodeCoverage.Impl internal class CoverageLineMarkTagger : CoverageLineTaggerBase, IListener { private ICoverageMarginOptions coverageMarginOptions; - public CoverageLineMarkTagger(ITextBuffer textBuffer, List lastCoverageLines, ICoverageMarginOptions coverageMarginOptions) : + public CoverageLineMarkTagger(ITextBuffer textBuffer, FileLineCoverage lastCoverageLines, ICoverageMarginOptions coverageMarginOptions) : base(textBuffer, lastCoverageLines) { this.coverageMarginOptions = coverageMarginOptions; @@ -21,13 +22,13 @@ public void Handle(CoverageMarginOptionsChangedMessage message) RaiseTagsChanged(); } - protected override TagSpan GetTagSpan(CoverageLine coverageLine, SnapshotSpan span) + protected override TagSpan GetTagSpan(Engine.Cobertura.Line coverageLine, SnapshotSpan span) { var coverageType = coverageLine.GetCoverageType(); var shouldShow = coverageMarginOptions.Show(coverageType); if (!shouldShow) return null; - var newSnapshotSpan = GetLineSnapshotSpan(coverageLine.Line.Number, span); + var newSnapshotSpan = GetLineSnapshotSpan(coverageLine.Number, span); return new TagSpan(newSnapshotSpan, new OverviewMarkTag(GetMarkKindName(coverageLine))); } @@ -41,9 +42,8 @@ private SnapshotSpan GetLineSnapshotSpan(int lineNumber, SnapshotSpan originalSp return new SnapshotSpan(startPoint, endPoint); } - private string GetMarkKindName(CoverageLine coverageLine) + private string GetMarkKindName(Line line) { - var line = coverageLine.Line; var lineHitCount = line?.Hits ?? 0; var lineConditionCoverage = line?.ConditionCoverage?.Trim(); diff --git a/SharedProject/Impl/CoverageColour/OverviewMargin/CoverageLineMarkTaggerProvider.cs b/SharedProject/Impl/CoverageColour/OverviewMargin/CoverageLineMarkTaggerProvider.cs index 1933a168..e58c7350 100644 --- a/SharedProject/Impl/CoverageColour/OverviewMargin/CoverageLineMarkTaggerProvider.cs +++ b/SharedProject/Impl/CoverageColour/OverviewMargin/CoverageLineMarkTaggerProvider.cs @@ -37,7 +37,7 @@ private void AppOptionsProvider_OptionsChanged(IAppOptions appOptions) } } - protected override CoverageLineMarkTagger CreateTagger(ITextBuffer textBuffer, List lastCoverageLines) + protected override CoverageLineMarkTagger CreateTagger(ITextBuffer textBuffer, FileLineCoverage lastCoverageLines) { return new CoverageLineMarkTagger(textBuffer, lastCoverageLines, coverageMarginOptions); } diff --git a/SharedProject/Impl/CoverageType.cs b/SharedProject/Impl/CoverageType.cs index 7fa759c4..0b4937a6 100644 --- a/SharedProject/Impl/CoverageType.cs +++ b/SharedProject/Impl/CoverageType.cs @@ -6,9 +6,8 @@ internal enum CoverageType { Covered, Partial, NotCovered } internal static class CoverageLineExtensions { - public static CoverageType GetCoverageType(this CoverageLine coverageLine) + public static CoverageType GetCoverageType(this Engine.Cobertura.Line line) { - var line = coverageLine?.Line; var lineHitCount = line?.Hits ?? 0; var lineConditionCoverage = line?.ConditionCoverage?.Trim(); diff --git a/SharedProject/Impl/Logger.cs b/SharedProject/Impl/Logger.cs index c9c754f6..62291b43 100644 --- a/SharedProject/Impl/Logger.cs +++ b/SharedProject/Impl/Logger.cs @@ -60,6 +60,7 @@ private void LogImpl(object[] message, bool withTitle) { try { + var logTime = DateTime.Now; var messageList = new List(message?.Select(x => x?.ToString()?.Trim(' ', '\r', '\n')).Where(x => !string.IsNullOrWhiteSpace(x))); if (!messageList.Any()) @@ -85,7 +86,7 @@ private void LogImpl(object[] message, bool withTitle) if (withTitle) { - _pane.OutputStringThreadSafe($"{Environment.NewLine}{Vsix.Name} : {logs}{Environment.NewLine}"); + _pane.OutputStringThreadSafe($"{Vsix.Name} {logTime}: {logs}{Environment.NewLine}"); } else { diff --git a/SharedProject/SharedProject.projitems b/SharedProject/SharedProject.projitems index 243d0c3e..caff195f 100644 --- a/SharedProject/SharedProject.projitems +++ b/SharedProject/SharedProject.projitems @@ -69,13 +69,13 @@ - + @@ -148,6 +148,7 @@ +