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
459 stars 88 forks source link

Add helper documentation to aid people using preview coverage report #324

Open leogott opened 3 years ago

leogott commented 3 years ago

Description

Improve documentation and extension warnings to give hints about the problem and how to fix it.

Work

Triage

See the comment below https://github.com/ryanluker/vscode-coverage-gutters/issues/324#issuecomment-869533580

Original Ticket Title

Preview Coverage Report does not work with the defaults while Show Gutter Coverage does

Describe the bug Possibly a fix in documentation/ helpful pop-ups, but: Without changing the (quite crowded) settings, Add/Remove Watch seems to be working, and coverage is displayed in the gutter properly. But I can't get preview coverage report to do anything beside throwing pop-ups at me.

To Reproduce Steps to reproduce the behaviour:

  1. Run 'Coverage Gutters: Preview Coverage Report'

  2. This entry field opens. Try to enter the name of the coverage-report file, the path to it, anything. grafik

  3. Click somewhere else. Get these messages. grafik

Expected behaviour I expected the entry field to contain suggestions or accept the relative path to a file, (or to warn me that something is misconfigured).

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context The project uses the jacoco maven plugin to report coverage.

ryanluker commented 3 years ago

@leogott Thanks for submitting an issue! We have an example project that is used for testing the "preview" coverage functionality. https://github.com/ryanluker/vscode-coverage-gutters/blob/master/example/node/index.html

If you load the above node example you should be able to use the preview coverage report command and see a list of file options to use. Currently the preview functionality is only setup to look for a couple files based on a glob pattern (it hasn't been improved or touched in a while development wise sadly) and you can find the default here if you haven't seen this already. https://github.com/ryanluker/vscode-coverage-gutters/blob/master/package.json#L146-L150

If it would be possible to loosen the restriction of the index.html being in the coverage folder I would but I don't think it would as useful given there might be a ton of index.html's in peoples projects that are not related to a coverage report.

One area we could improve on is making changes to the readme explaining how to modify this (you eluded to this in your ticket around improving discoverability) but I believe the preview is one of the less used features of the extension so not much time has been spent on maintaining or creating documentation.

leogott commented 3 years ago

Thank you for the extensive reply! My use case for the coverage preview is that I have a setup with Windows and WSL, and opening the reports in Firefox isn't trivial.

Yeah after modifying the regexpression to target/site/jacoco/**/index.html the feature worked (mostly) as expected. (the icons are missing and the table looks kinda weird)

Maybe a solution would be for Choose a Coverage Report to preview. to not appear if coverageReportFileName does not match anything, and instead a popup to appear:

Coverage Report not found
No files matched %{coverageReportFileName}.
[Edit setting] (Link to setting coverageReportFileName)
ryanluker commented 3 years ago

@leogott Good thinking on the improved error front! I will add some of those bits to the main part of the story.

On the icons not loading issue, I have seen this before and sometimes the webview, being set to a strict security mode, wont allow even local relative files to be loaded (icons, css, etc). You can see another ticket for this here https://github.com/ryanluker/vscode-coverage-gutters/issues/250#issuecomment-578534797 and after the recent work we did for the webview security this might be simpler 🤔 . https://code.visualstudio.com/api/extension-guides/webview#loading-local-content

ryanluker commented 2 years ago

Related to #333 / #369 and fixed in #363