Early Access Program

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

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

image description

Discover more