CLion Starts the 2022.1 EAP
The CLion 2022.1 Early Access Preview program starts today!
As promised in the roadmap announcement, we’ll be focusing on quality in this release cycle, addressing the most annoying and painful bugs, and improving existing workflows. But you can also expect some new features, which we started working on earlier, to become available. We’ll be grateful to learn how well they work for you so we can make them even better before the public release.
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 221.3427.90 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:
- New remote development capabilities are bundled
- Build tool in Toolchains settings
- Enhanced UX for CMake generator
- CMake profiling
- Namespaces in the New C++ Class dialog
- Preview for intention actions
- Grouping by the qualified name in the Structure view
- Updated Clang-Tidy settings
- Docker toolchain
- And other notable fixes
New remote development capabilities are bundled
The new remote development mode was announced in the 2021.3 versions of our IntelliJ-based IDEs, including CLion. The main idea behind remote development is to use a powerful remote machine to execute all IDE operations and to build, run, and debug code – all while running the IDE on a local thin client. A remote host is a physical or virtual machine hosting the source code and running the headless IDE (i.e. CLion) to perform most of the IDE functions.
As we described in the release blog post, CLion 2021.3 didn’t bundle this functionality because there were several major workflow issues at the Beta stage, and JetBrains Gateway needed to connect the remote server and start a local thin client. But with 2022.1 EAP, the new remote development capabilities are now bundled in CLion! To access JetBrains Gateway, select Remote Development on CLion’s Welcome screen:
Build tool in Toolchains settings
In Toolchains settings (Settings/Preferences | Build, Execution, Deployment | Toolchains) you can now configure any build tool to be used with a toolchain. Previously, the make tool was required in this field, which you could later substitute with Ninja, for example in CMake profiles. This worked, but was definitely inconvenient and non-intuitive. Now you can specify the build tool in the Toolchains settings. In default toolchains, Ninja is used when nothing is configured:
Enhanced UX for CMake generator
We’re continuing to make the CMake generator easier to use in CLion. Two options are worth noticing in the generator dropdown list in CMake Profile settings, one new and one updated:
- Use default – for new projects, this option now takes the build tool configured for the toolchain selected in the corresponding CMake Profile. The actual value is also shown in the dropdown option.
- Let CMake decide – this option means CLion won’t be forcing any CMake generator explicitly, meaning that CMake will decide what generator to use. By default, CMake uses the CMAKE_GENERATOR environment variable to determine the CMake generator (CMAKE_GENERATOR).
CMake profiling
Have you ever wondered why it takes a long time to reload your CMake project? CMake 3.18 introduced a way to generate trace information while generating a project. You can use it to inspect the tracing results and identify specific places in your CMake scripts that can be improved.
CMake uses Google’s Trace Event format for the results. To enable the tracing, simply add two flags to the CMake command: --profiling-format=google-trace
and --profiling-output=<path>
. CMake will then generate a JSON file with the tracing results under the specified <path>
.
What’s new in this CLion EAP is that it can now help you run the tracing and visualize the results:
Use one of these two ways to enable the CMake tracing:
- Manual: add
--profiling-format=google-trace
and--profiling-output=<path>
to the CMake options in your project. - Automatic: click Add event tracing to CMake in the CMake tool window:
CLion will search for configurations with the CMake profiling option (with the -event-trace suffix in the name). If none are found, the IDE will copy the profile that is currently selected and add the required options:
Once the CMake profile is reloaded, CLion will show a notification suggesting to open the profiling information:
In the profiling tool window you can:
- On the left-hand side: inspect the process ID and thread ID for the CMake reload process.
- In the center: inspect the flame chart showing the stack trace of the CMake process in each time frame during the CMake reload.
- On the right-hand side: explore the details of the selected event. Details include event (function) name, duration, function arguments, and where the function is located in CMake scripts.
Namespaces in the 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 can write in any existing or nonexistent namespace (which will be created along with the new class), a nested namespace, or even an anonymous (unnamed) namespace if you enter a blank space in this field:
The field has basic validation checking the identifier is a valid namespace name or a blank space.
Preview for intention actions
CLion’s intention actions cover a wide range of situations, from warnings to optimization suggestions. As you probably know, you can click the bulb icon or press Alt+Enter
to open the list of suggestions and select an action from the list. Starting with this EAP, now you can also see a preview of the result of the selected action:
To activate it, press Ctrl+Q
(on Windows/Linux) or F1
(on macOS).
The preview is not available for all intention actions. If an intention action is too complex and the preview cannot be generated, you will see the intention action’s description. The preview is available, however, for DeMorgan laws, invert if condition, merge if-else, merge nested if, Clang-Tidy, MISRA, Clazy, split declaration and assignment, split into separate declarations, and a few others.
Once activated, the preview will appear every time you open the list of available intention actions. To close the preview, press the shortcut again while the list of intention actions is open.
Grouping by the qualified name in the Structure view
In the Structure view, elements can now be grouped by the qualified name:
Select between grouped view or plain view with fully qualified name included in each element name.
Clang-Tidy settings
Clang-Tidy settings in CLion can be configured in Settings/Preferences | Editor | InspectionsC/C++ | Static Analysis Tools | Clang-Tidy. This EAP build comes with an updated dialog for checks configuration that simplifies the enable/disable process, by providing a tree with all the checks:
Speed search helps you find the required checks quicker – just start typing the name you are looking for when the dialog is in focus. Click the Visit Help Page icon (planet symbol) to navigate to the documentation on the LLVM website describing the check in detail.
Docker toolchain
When working with the Docker toolchain, you can now provide additional container settings, such as port and volume bindings, and others:
Notable fixes
As this is a quality-focused release, we’d like to highlight some of the important fixes we’re delivering in this EAP build:
- Project model:
- Conflicts in CLion when setting build directory in CMake presets have been resolved (CPP-26755).
- Makefile projects are now loaded correctly when using the Cygwin toolchain (CPP-27539).
- CLion can now successfully find the compiler executable for compilation database projects with the Windows system toolchain (CPP-27732).
- Embedded:
- Fixes for STM32CubeMX projects (CPP-15489, CPP-23278, CPP-26942).
- FreeRTOS GCC/Posix port is now supported and thus enables FreeRTOS debug on Linux (CPP-26898).
- Macros now work in Embedded GDB Server configuration fields (CPP-27286). CMake variables now work for Embedded and Remote run/debug configurations (CPP-19627).
- Dynamic analysis:
- For remote toolchains, Valgrind and Sanitizers previews are now displayed correctly for out-of-project header files (CPP-23847).
- Refactorings:
- Clangd:
- Editor:
The full release notes are available here.
Your CLion team
JetBrains
The Drive to Develop