CLion 1.5 EAP: new code generation possibilities and improved auto-import
Previous CLion EAP build included variadic templates support and was called experimental, since we were not sure about the quality of the support and the performance. After a week we see that though some issues and regressions are still present, the overall impression is positive, so we decided to push variadic templates to the upcoming release.
Today another EAP build is available for download, and its main focus is code generation.
Generate definitions and more
CLion helps you implement your ideas at the speed of thought with the code generation features, getting routine and mundane tasks out of your way. The set of features includes Override/Implement, generating constructors/destructors and getter/setter functions, ‘Surround with’ and Live Templates, and create from usage possibility.
Override and Implement actions generate stubs for virtual member functions from any of base classes. Having a couple of requests related to these features, we now added generate definitions (
Shift+Ctrl+D on Windows/Linux,
⇧⌘D on OS X), that (we believe you can guess!) generates definitions for existing declarations. If the caret is placed inside the class, then the definition will be located right there in-place. In other cases, CLion will ask you about possible destinations (if several are possible):
By the way, Override/Implement features now work in the same way, asking for a destination (if several options are available) or generating code in-place for the caret located inside the class. That means if you want the function to be generated in a header file – locate the caret in that class in your header file, and if you want it in the source file – execute action there.
Generate definitions can be called in various ways:
- By pressing
⇧⌘Don OS X.
- From the generate menu (
⌘Non OS X):
- As an intention action (
Alt+Enter) – the only difference from the above is that intention action can generate only one definition at a time, while other options allow you to generate several function definitions at once.
This also makes Implement action more logical and consistent with other JetBrains IDEs – now it just overrides pure virtual functions from base classes.
Try this new feature and let us know what you think!
Another big change introduced in this EAP build is an improved auto-import. Import assistance in CLion allows you to add includes automatically when non-imported symbol is met. Just press
Alt+Enter and the include statement will be added, no need to move cursor from the current position and interrupt your editing session.
Some unexpected headers were suggested for STL symbols before. In this EAP build we’ve implemented special heuristics to solve the problem for C++ files and STL symbols, and we encourage you to evaluate the changes:
Besides, this build addresses the following problems:
- When the code generation is called or Extract Function refactoring is invoked, the enum types arguments and return types are now passed by value, not by reference (CPP-5781).
- The bug with generating incorrect implementation for functions with default value is fixed (CPP-1889).
- The bug with Rename that didn’t update non-code usages in case refactor preview was called is now fixed (CPP-5471).
As usual, full release notes are available by the link. Download the build 144.4199 from the confluence page. Unfortunately, due to some technical issues patches are not available this time. We are sorry for the inconvenience.
Read about all new features coming to the next release on Preview Next Version page on our site.
The CLion Team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
CLion 2023.3 EAP2: Support for Device Tree Files and Meson
The CLion 2023.3 Early Access Program has just started, featuring assembly view for files, enhanced C++ data flow analysis, and other updates. The CLion 2023.3 EAP2 build is ready for you to try! With it, you can finally start working on Meson projects in CLion and benefit from device tree format s…
The CLion 2023.3 Early Access Program Is Open
We recently shared our preliminary plans for v2023.3, which we plan to release at the end of November. We are now happy to announce that the CLion 2023.3 Early Access Program (EAP) starts today! Our EAP lets the community participate in discussions devoted to our products and influence the developm…
CLion 2023.2 Release Candidate
CLion 2023.2 is on its way, while the release candidate for v2023.2 is already available! To install CLion 2023.2 RC (build 232.8660.139), download it from the website, update via the Toolbox App, or use this snap package (for Ubuntu). Please note, you need an active subscription or a trial lice…
CLion 2023.2 Goes Beta
The Beta version of CLion 2023.2 is now available with the key improvements and changes that are expected in the upcoming release. Download build 232.8660.49 from our website, via the Toolbox App, or as a snap package (for Ubuntu). DOWNLOAD CLION 2023.2 BETA Text search in Search Everywhere Searc…