zero9178 / C-Cpp-Coverage-for-CLion

Get coverage data in CLion using gcov or llvm-cov
MIT License
38 stars 2 forks source link

Maybe provide feedback if no results after clicking Plugin's action #24

Closed claremacrae closed 3 years ago

claremacrae commented 3 years ago

If I accidentally all click on the Plugin's "Run Coverage" button in a profile/config that is not setup for coverage measurement, I don't get any feedback.

Right now, my process is to:

  1. Click on the Clion "Run with Coverage" button, and have it create a new config with coverage enabled.
  2. Switch to running this plugin's coverage button instead....

I'm not sure what to suggest as a better action...

Maybe at least, if someone explicitly clicked on your Coverage button and no coverage is found, could you pop up a message saying "click here for help with enabling coverage" - and take users to your README...

Then we can work on its wording, over time - to help those new to coverage to set up their environment.

zero9178 commented 3 years ago

I will have to take a look at how CLion does this. I personally like having a CMake option in my own CMakeLists.txt files and have seen a few projects using that as well. It's nevertheless probably a good idea to suggest to users to auto create a cmake profile with the needed flags and also offer a "Do not ask again" button that would lead to not suggesting it for that particular project anymore.

I will try to get around to implementing this once I got more time on my hands.

zero9178 commented 3 years ago

I have looked at CLions APIs and to my luck discovered their code that implements creating the CMake profile. It was nicely separated and easy to use so I could nicely reuse it. I am currently displaying it right after the process terminated. I could also display the error notification right after the process started, but I am not yet sure if that is a better idea.

In its current implementation it works roughly as it does in CLion. If coverage was explicitly requested using the coverage run button, but the right compiler flags had not been found it will give an error with a clickable hyperlink, which when clicked will create a new CMake profile that sets the right flags for either clang or GCC.

I have not implemented a "Do not ask again" link yet, and I am not yet sure if I will.

I am planning to release this version, among other subtle fixes and Clang 12 integration on Monday. I have attached the current binary if you want to test it out yourself meanwhile.

C C++ Coverage-2020.3.1.zip