CLion 2022.1: A Quality-Focused Release
CLion 2022.1 is now available! It is focused on quality improvements and enhancements for existing features and workflows like remote development, Docker, CMake Presets integration, and more. It also brings a brand-new CMake Profiling ability that helps you visually inspect why your CMake project may be taking a long time to reload. Code analysis and in-editor type and parameter hints have been tuned to work better and more accurately with modern C++.
To update to the new version, you can use the Toolbox App or a snap package (on Ubuntu), download the installer from our website, or apply the patch update to upgrade from version 2021.3.
Enhanced in-editor experience
For this release we’ve polished many CLion features that make your coding experience more comfortable, easy, and productive. We focused on their flexibility and accuracy regarding the modern C++ language.
Inlay hints
Parameter and type hints help you read and maintain your existing codebases with ease. The extra information is shown right in the editor and helps with parameter names in function calls and deduced types.
We’ve implemented a number of fixes to make inlay hints in C++ code more accurate, for example:
- CLion now displays a user-friendly
wstring
alias as a type hint for thestd::basic_string<wchar_t>
type. - CLion now displays an accurate type hint for dependent types.
- CLion 2022.1 offers better hints for the
emplace
,emplace_back
/emplace_front
, andmake_unique
/make_shared
functions.
In CLion 2022.1 we’ve enhanced the settings in Settings/Preferences | Editor | Inlay Hints with some explanations and code examples. You can now better understand the cases where the hints are shown and tune the settings to your preferences. Hints for array indices can now be disabled if you don’t need them. Previously this was not possible.
Code analysis
Because code analysis is a key part of the IDE, we’ve been working to make it more accurate and easier to configure, and to make its notifications more informative.
The Clang-Tidy and MISRA settings in Settings/Preferences | Editor | Inspections | C/C++ | Static Analysis Tools were reworked to make the process of configuring checks easier. A new visual representation includes a tree with all of the checks. Speed search helps you find the checks you need faster – just start typing the name you are looking for when the dialog is in focus.
For Clang-Tidy, the dialog also links to LLVM documentation to help you learn about the checks in more detail.
It’s much easier to improve your code when the suggestions from the IDE not only name the problem and suggest the fix, but also show how the selected fix will transform the code. That’s why we’ve added a preview for intention actions:
For Clang-Tidy, the issue causing incorrect results to occur when the WSL toolchain was used has been fixed by setting Clang-Tidy to execute inside the WSL itself.
New C++ Class dialog
When creating a new C++ class, you can now specify the namespace where you’d like the new class to be located. You’ll find a new field dedicated to this in the dialog:
Structure View popup
Structure View helps you navigate through the current file in just a few clicks. Sometimes you want the elements there to go in the same order as in the original file, but sometimes you want them to be grouped by the qualified name. There is now a dedicated toggle in the dialog that allows you to switch between these modes.
Formatter
New formatter options for structured bindings were added to the Spaces and Wrapping and Braces sections:
More powerful CMake support
CMake is a first-class citizen project model in CLion. In this release, we focused on the flexibility of configuring CMake in CLion, as well as improving the CMake editing experience and adding profiling support.
CMake presets and CLion profiles
CMake 3.19 introduced CMake Presets, a universal way to configure CMake and share the configurations within your team. It’s still young and is evolving quickly, with many approaches being tested and then later updated based on feedback from people using them in real projects. CLion’s support for CMake Presets is also evolving. We now create CMake profiles for configure presets. CLion uses CMake profiles to run and debug your application, but it previously only created them for build presets. Configure profiles allow redundant build presets to be removed in many cases.
If you don’t want CLion to create profiles from presets at all, a new setting that controls this was added to Settings/Preferences | Advanced Settings | CMake | Enable CMake Presets integration. Another setting there is the option to set CMake profiles in CLion to reload sequentially. You might need this in the event of non-trivial connections between profiles that make parallel reload (the default in CLion) impossible:
CMake generators
In the CLion toolchain, you can now configure any build tool of your choice, not just make. Now if you need one specific build tool for all profiles working with a specific toolchain, you can simply configure it in the toolchain itself instead of configuring it in every CMake profile. In CMake profiles, this means that the Use default option is selected in the generator field. Another new value in the generator setting is Let CMake decide. With this option selected, CLion won’t favor any CMake generator explicitly, and CMake will decide which generator to use instead.
CMake formatting
Formatting support in CMake scripts now helps with if()
...
endif()
, else()
, elseif()
, endforeach()
, endfunction()
, endmacro()
, and endwhile()
commands and their corresponding blocks. They are correctly aligned, pairing braces are highlighted, and the blocks can be folded:
CMake profiling
Have you ever wondered why it occasionally takes a long time to reload your CMake project? CMake v3.18 brought the new ability to profile your CMake scripts and inspect the traces to find the answer. CLion now offers support for this feature, including the automatic creation of profiling configurations and the visualization of tracing results. Learn more.
Wider range of debugger options
If you develop with CUDA, you’ll be happy to learn that we’ve fixed some critical issues that were preventing you from using CUDA-GDB in CLion. To make it work, you’ll need to specify the cuda-gdb binary in the debugger setting of your current toolchain and use the following compiler option to add CUDA debug symbols: add_compile_options(-G)
.
For developers on Windows using the Visual Studio C++ toolchain, CLion comes with the LLDB-based debugger maintained by the JetBrains team. The hex value view in this debugger has been fixed and you can now enable it using Settings | Build, Execution, Deployment | Debugger | Data Views | C/C++ | Show integers as hex values and Display alongside the original value.
Toolchains
With container-based development being massively popular, Docker toolchain is one of the most widely used in CLion. In version 2022.1, we’ve improved its integration in CLion:
- The Valgrind Memcheck tool for detecting memory-usage problems now works with the Docker toolchain.
- In the toolchain settings you can now provide additional container settings, such as port and volume bindings.
Another big story is remote development. In the previous release, CLion got support for the new remote development workflow with the thin client. This support is now getting some enhancements and is available from the Welcome screen – you no longer need to install any additional gateway software, as it’s now bundled in CLion:
Cloud dev environments featured in Space can now be used with CLion to speed up onboarding, access a ready-to-use IDE in seconds, and manage your development resources efficiently. Learn more about Space dev environments.
That’s it for now! We encourage you to give CLion 2022.1 a try. If you have an active subscription, you can update today. Otherwise, we invite you to start your free 30-day trial to check out the new features and see what you think!
Your CLion team
JetBrains
The Drive to Develop