ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
464 stars 90 forks source link

Reset coverage in a file when the file is changed #183

Open SimonKagstrom opened 6 years ago

SimonKagstrom commented 6 years ago

When changing the source code of a file, it would be nice if coverage for that particular file could be reset until it has been built and run again. Or perhaps marked with yellow to indicate that it is old data.

I understand that not all people like this behavior, so having it as an option would be good.

Going by file timestamp compared to the timestamp of the coverage file would be sufficient I think.

Thanks a lot for this extension by the way, it sort of won me over to the vs code camp from eclipse!

ryanluker commented 6 years ago

@SimonKagstrom thanks for the issue. I could see there being a file watcher that would remove the coverage indicators from a file that was modified. The VSCode api's gives you quite a few hooks for these kinds of operations (see the current watchers [0] for an example and it should be easy to implement something like this as well).

[0] https://github.com/ryanluker/vscode-coverage-gutters/blob/master/src/coverage-system/coverageservice.ts#L118

ryanluker commented 5 years ago

@SimonKagstrom I moved this issue into the 2.3.0 release but I had one question before I would start work on it. When you said "reset" the coverage for the file did you mean that the coverage for the whole file would be removed until reapplied?

SimonKagstrom commented 5 years ago

For me it would be OK to remove it, but the best is perhaps to change the marks for edited lines to orange or something like that (or remove just that marker).

I've also seen that if you add a newline on a covered line, the new line is also considered as covered. It would be better to have it unmarked I think.

Thanks for looking into it!