CLion 2020.2 EAP: Code Coverage, Git installed in WSL2, and Problems View

Posted on by Anastasia Kazakova

The 2020.2 Early Access Program has just started, but we’ve already announced so much cool stuff – makefile project support, doctest, updates to the PlatformIO plugin, dozens of enhancements in the debugger for the Microsoft Visual C++ toolchain, and more. If you’ve had a chance to try any of these, let us know your impressions!

But of course we are not stopping there. This week brings another EAP build with useful improvements in these areas:

Build 202.5792.50 is available from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu). A patch update is ready for anyone using the previous 2020.2 EAP build:

DOWNLOAD CLION 2020.2 EAP

Code coverage enhancements

In CLion, you can run CMake applications and tests with code coverage measurements. Code coverage results provide the percentage of code lines executed during a run and the number of times a particular line was hit.

The implementation relies on the llvm-cov/gcov integration, and it previously required the corresponding coverage flags to be passed manually. In CLion 2020.2, we’ve improved the user experience by adding coverage flags automatically when you click the Run with Coverage button.

Of course, this doesn’t happen silently. When the run with coverage is activated but no coverage files (.gcov or .profraw) are found, CLion will suggest adding the flags:
Coverage notification

If you click Fix and rerun, CLion will do the following:

  • Search for an existing CMake profile with the same Build type, Toolchain, and CMake Options as in the currently used profile, but with added compiler options for coverage. If one is found, CLion will switch to it.
  • If not, CLion will create a new CMake profile (in Settings/Preferences | Build, Execution, Deployment | CMake), copy the Build type, Toolchain, and CMake Options from the current profile, and pass the coverage flags as
    CMAKE_CXX_FLAGS and CMAKE_C_FLAGS in CMake options.
  • Run with Coverage using this newly created or found CMake Profile.

You’ll see the coverage results in the Coverage tool window:
Coverage results

In addition, Coverage now works for the Clang-cl compiler.

Support for Git installed in WSL2

Windows Subsystem for Linux (WSL and WSL2) is an essential tool for those who develop for Linux while working on Windows. With the WSL toolchain setup for your project in CLion, you can build using CMake and compilers from Linux, and run/debug on WSL – all from inside CLion on your Windows machine.

The great news is that CLion VCS support now is compatible with the Git that’s installed in WSL2! The IDE automatically switches between Git executables depending on the project location. So if the project is opened from WSL (via \\wsl$ path), all Git-related features in the IDE will work via the Git executable from WSL2.
WSL2 Git

Some known restrictions:

  • This only works for WSL2; WSL1 is not supported.
  • This works for the WSL2 that came with the May update of Windows 10, version 2004.

Inspection Widget and Problems View

You may have already noticed the new Inspection Widget in the CLion 2020.2 EAP:
Inspection widget
It displays the number of warnings and errors in the current file and lets you navigate between them with ease. You can also configure the highlighting level: none, errors only, or all problems. Previously, this was possible with the so-called Hector icon – the Inspector icon on the Status bar, or by using the icon in the top right-hand corner of the file.

Now if you click the Inspection Widget, the Problems View tool window will open:
Problems View

Alternatively, you can open it via the main menu | View | Tool Window | Problems.

The Problems View tool window shows the list of warnings and errors in the current file and gives you a description of these problems. What’s more, you can quickly fix the problems right from this tool window, by invoking the Alt+Enter shortcut. You can also navigate from the Problems View tool window to the place in your code where the problem was encountered with just one right-click of your mouse.

The full release notes are available here. Give this EAP build a try and share your feedback with us!

DOWNLOAD CLION 2020.2 EAP

P.S. If you are new to CLion or feel you might not be aware of its full power, we have a free live webinar for you called CLion 101 and Beyond! Register now to reserve a seat and join us on Tuesday, June 23. The webinar will be hosted by Phil Nash, our C++ Tools Developer Advocate at JetBrains, and rest assured he’ll teach you a trick or two!

Your CLion team
JetBrains
The Drive to Develop

Comments below can no longer be edited.

12 Responses to CLion 2020.2 EAP: Code Coverage, Git installed in WSL2, and Problems View

  1. Taw says:

    June 20, 2020

    The feature with “Inspection Widget and Problems View” is nice, but then the sidebar becomes crowded and people like me, who like clean sidebar, have to right-click and “remove from sidebar”.
    Sometimes by mistake I press the problems icon and the Problems sidebar appears then I have to remove it.

    I created a bug related to having a shortcut or a faster wat to remove a sidebar view. It seems that I cannot do this via keyboard or in a simpler way: CPP-20869, always right click- remove.

  2. Taw says:

    June 20, 2020

    Anastasia, “Go to declaration or usages” seems broken in EAP, it worked perfectly until now, see CPP-20870. Thanks.

    • Taw says:

      June 21, 2020

      Wow, CPP-20875 is a tough one, cannot go to declaration at all…

      • Anastasia Kazakova says:

        June 22, 2020

        It’s not exactly a bug. But it seems the behavior is not ideal indeed. We’ll proceed in the tickets with the discussion.

        • Tano says:

          June 24, 2020

          Thanks, I manage to have a workaround with the registry key “Help | Find Action | Registry | cidr.navigation.gotoDeclaration.overrides.showUsages”

          Can you tell me please if this registry key is saved after updating to a newer CLion version and also when export/import settings? It seems that the dev on that task did not answser me to this important question.
          Thank you Anastasia

          • Anastasia Kazakova says:

            June 24, 2020

            The Registry key is not a user-friendly way to configure the IDE and we do not recommend it. It’s just a quick workaround for you now. We’ll implement a proper IDE setting a bit later.

  3. Tano says:

    June 24, 2020

    Anastasia, any chance that you will open-source some of CLion features?
    I would gladly contribute to it. There are 6600 bugs and it seems that they are not decreasing…
    As much I would like to apply to JetBrains and to move to Russia, I would not survive russian winters. 😀

    • Anastasia Kazakova says:

      June 24, 2020

      We have offices in Munich and Amsterdam as well) And a head-quarter in Prague of course.

      Seriously speaking, no, there are no such plans. And we don’t think that it’s realistically possible to open source some core functionality blocks to make them extendable from the outside at this point.

      • Tano says:

        June 24, 2020

        I understand regarding open-source, I want somehow to contribute make CLion better, it’s impossible for such a small team to fix all the problems. And except posting bugs, I don’t know how to contribute, because I really want to. 🙂

        • Anastasia Kazakova says:

          June 24, 2020

          Reporting issues also help. However, we would appreciate if you are able to add reproducible cases to some unobvious issues, as it takes the most time. I understand the code is often closed source, but if you can create a sample to reproduce (language issues or performance problems) it always speed up the fix a lot! But thank you anyway for your input and willingness to help!

  4. Fernando Rodriguez says:

    June 25, 2020

    The “Attach to Process …” function in Windows with lldb and msvc. When will it be available?

    • Anastasia Kazakova says:

      June 25, 2020

      It should generally work. What are the issues with it?

Subscribe

Subscribe for updates