CLion Starts the 2022.3 EAP With the CMake Integration at a Next Level
The CLion 2022.3 Early Access Preview program starts today!
Give the free EAP builds a try and let us know what you think about the changes! Share your feedback in the comments or submit it to our issue tracker.
Build 223.4884.72 is available from our website via the Toolbox App or as a snap package (if you are using Ubuntu). Note that if you are on macOS, there is a separate build for Apple Silicon (M1 chip).
Here are the main highlights:
- CMake
- Toolchains enhancement for remote mode and Docker
- Improved settings for Clang-Tidy checks
- Many other fixes
CMake integration becomes richer
CMake is the most popular project model in the C++ world. But it’s not easy to maintain CMake projects and CMake scripts. CLion helps you with many tasks by automating them and making your CMake experience more pleasant.
A new action to add a file to the existing CMake target
When there is a file in your CMake-based project that doesn’t belong to any CMake target, the CLion code assist is limited in such files. In order to get the full functionality, you need the file to be added to some CMake target so that CLion can learn all the compiler flags and other information needed to parse it correctly. You might have noticed notifications like This file does not belong to any target… on such files in the editor:
We’ve just added a new action which helps you add a file to the existing CMake target. You can call it via the Add to CMake Project quick-fix shown on the notification bar mentioned earlier:
Or find the quick fix as a separate action in project view context menu:
The latter also supports adding multiple files, when they are all explicitly selected.
Note that this action only works in CMake projects for C++ files which are not currently part of the project and are not located in the excluded directories. For the time being, there are still a few kinks left to work out. For example, the action doesn’t support adding full directories (CPP-1675), and there are some UI glitches that we are aware of and currently working on.
CMake font and color settings
The CMake files editor in CLion is enhanced with the configurable font and color setting now. Find them at Settings / Preferences | Editor | Color Scheme | CMake:
CMake foldings
Expanding and collapsing various code regions in CMake is now available in CLion. You can collapse (Ctrl+NumPad-
on Windows and Linux, ⌘-
on macOS) macros and functions, if-else clauses, comments, and even an arbitrary selection:
Code completion for find_package
In the find_package
command, CLion now provides code completion for the packages bundled with CMake:
CMake command documentation in code completion
In CLion 2022.2 we added a documentation popup for CMake commands. It’s now also available in CMake code completion, when called for the selected completion option:
CMake structure view
You can examine the structure of the file currently opened in the editor using the Structure tool window or the Structure popup. This now works for CMakeLists.txt files as well! It brings a quick overview of variables, functions, macros, and targets used in the CMake file:
Toolchains enhancement
In CLion 2022.3 EAP, the collecting compiler information action was fixed in many scenarios where it failed before. In addition, we’ve made noticeable improvements to the remote toolchains:
- Local sources are usually synchronized to the remote host in full remote mode. This is also applied to the CMake build folder. However, now you can skip this step if the Local or mounted folder deployment type is selected in Settings/Preferences | Build, Execution, Deployment | Deployment and if the CMake build folder is stored under one of the existing path mappings.
- CLion now uses pigz for compression on the remote host to synchronize the header search paths back to the local host, instead of gzip. This multithreaded gzip implementation makes things work faster.
For Docker toolchain, the rootless mode is now supported (CPP-30248).
Learn more about Clang-Tidy checks with CLion
We keep pace with the LLVM updates and have updated our Clangd-based language engine. This also includes a built-in Clang-Tidy binary updated to v16.0.0. This brings new checks and various LLVM fixes to our users. CLion will notify you about the new checks once you get the new build:
Have you noticed that the Clang-Tidy settings were updated with the detailed documentation now rendered on the left? Now you can read the explanation behind the check and better understand why it can be useful for you.
The Clang-Tidy tooltip was also improved. By clicking on the three dots on the right and choosing Show Inspection Description, now you’ll get a short description of a particular Clang-Tidy check. And if you want more, use the special Learn More link that navigates you to the settings dialog, focusing on the selected check:
Other improvements
- Quick Documentation now shows the size of the type:
Similar to other inspections, this one uses the flags from the project model which CLion passes to Clangd. That means it should calculate the correct size for cross-compilation cases. - A new option to make the constructor explicit is available in the Change Signature refactoring (CPP-10337).
- We fixed the type hints presentation for function pointers (CPP-26880), removed redundant spaces in type hints, improved inaccurate type hints for
string
, and fixed type hints forshared_ptr
for the MSVC toolchain andunique_ptr
for GCC. - Several incorrect warnings in the data flow analysis were fixed.
- CLion now bundles all default web development plugins coming from WebStorm (for example, NodeJS, Karma, AngularJS, and others).
There are several known regressions in this EAP build which we plan to address in the next build:
- Run with administrative privileges is not working on Linux and OS X (IDEA-302315).
- Inlay hints in stl_vector.h are not working because of the clangd crash (CPP-30488).
Sorry for any inconveniences.
The full release notes are available here. Interested in what’s coming next? Check out our roadmap announcement!
Your CLion team
JetBrains
The Drive to Develop