p10tyr/PrestoCoverage

When changing source code coverage is incorrect

Closed this issue · 1 comments

After running tests and coverlet the margin glyphs are updated

When you start to add or remove lines then the glyphs are no longer valid since they are binding to the Line numbers in the coverage but we have now updated the source

Initial thoughts to solve the problem

  • Remove glyphs completely since they are no longer valid (easy)
  • grey them out but I cannot see the purpose for this since they will still be invalid
  • actively track changes... (difficult) would require me to rework the way lines are marked and then tracked somehow. Coverage files have all the required property and method names. I would rather prefer to stay away from this since it starts to make the extension to complicated. I am aiming for fast, easy, free.

Problem with removing them is then it looks like the tests/coverage have not run. May be confusing. The nice thing about changing the colour, probably Amber would show tests ran.. but now out of date. So rerunning it (maybe later from withing VS) would change everyback to red/green.

So it turned out to be easier than I thought.

There is an API available with document version and I can test if it has changed.

The quite nice thing about this is.. if you adding new code in .. the glyphs automatically move with the original line of code.. without me having to do any thing.. So that kind of worked out well.
When removing the line the glyph goes away and undoing wont bring it back.. that is OK for now.

When adding new lines I just do not add any glyphs.. it just continues

version 1.11+ now has this feature