Early Access Program News

CLion 2020.3 EAP: A New Qt UI Class Action, Extract Lambda Parameter Refactoring, and Easier Configuration for Exclude Paths

Have you checked out the new Core Dump debug that came in the CLion 2020.3 EAP last week? If not, we really recommend giving it a try. Meanwhile, we are moving forward through this EAP cycle with a new set of enhancements and fixes. Today in the EAP:

Build 203.5784.34 is available from our website, via the Toolbox App, or as a snap package (for Ubuntu).

DOWNLOAD CLION 2020.3 EAP

Qt UI Class templates

We are continuing to work on Qt support in CLion. In this EAP build we’ve added a new item to the New menu that helps you to create a Qt class along with a .ui file – Qt UI Class:

New File class

To open this menu, right click on the tree in the project view or use Alt+Insert on Windows/Linux or ⌘N on macOS.

Fill in the class name and select the parent class (QWidget, QMainWindow, or QDialog). .h/.cpp/.ui files will be generated using the Filename base as file names. If you wish, you can change the Filename base in the dialog as well.

new Qt UI class

Generated files follow the file templates listed in Settings/Preferences | Editor | File and Code Templates – Qt Class, Qt Class Header, Qt Designer Form. Feel free to tune the templates to fit your needs.

Qt files generated

QML syntax is not yet supported in CLion, however, you can install a 3rd party plugin that provides some basic support.

Extract Lambda Parameter

We’ve added a new Extract Lambda Parameter refactoring to the list of supported refactorings in CLion. It’s used to extract an expression or statement into a new parameter with a lambda expression passed as a corresponding argument. It could be a comparator passed to a sorting function, for example.

All Extract… refactorings are generally useful when you want to introduce more flexibility to your code and reuse some code blocks. Check out this short demo we’ve recorded which covers Extract Function, Extract Parameter, Extract Lambda Parameter, and Live Templates in CLion:

Note, there are still some major issues with Extract… refactorings. Here are some of the most notable ones:

  • CLion expands templates in Extract Parameter instead of using the canonical typedef (CPP-1932).
  • Extract Function on code using reference generates invalid syntax, as the resulting reference is declared without an initializing expression (CPP-2250).
  • Extract Function incorrectly applies const to the parameter (CPP-10335, CPP-22835). We plan to address both the above issues in the 2020.3 release.
  • A few known cases where the Extract… refactorings break on code with macros (i.e. CPP-3182 – the fix is planned for the 2020.3 release, CPP-1420).

There is a general plan for 2021 to focus on general improvements to refactoring correctness. It might take a while, but we hope to address this with some major language engine improvements.

Exclude Paths in Remote Deployment

For huge codebases, we have some performance tuning tips to help make CLion work faster on such projects. One of them is to speed up indexing by excluding certain folders and files from indexing. By default, CLion indexes all the directories listed in CMakeLists.txt for resolving the code correctly. However, your project may contain folders with binaries, logs, or build artifacts that do not affect the CLion code insight. Also, indexing some folders can be too expensive due to their size or location. In such cases, CLion can help with the Mark Directory as | Excluded action. But what happens to such excluded directories in Full Remote mode when sources are synchronized by CLion to the remote machine?

Good question! And now we have a good answer:

  1. Directories marked as Excluded locally are automatically marked as Excluded paths for remote toolchains when they are being initially configured. In practice, this means this directory won’t be synchronized with the remote machine.
  2. You can manually tune the list of Excluded paths for the current project in Settings/Preferences | Build, Execution, Deployment | Deployment:
    Excluded paths
  3. When you already have your remote toolchain configured and the project is synchronized, you can mark a directory as excluded and CLion will suggest that you update the excluded paths:
    Mark as Excluded
  4. When done, the excluded folder won’t be synchronized further.

  5. I you do the opposite, i.e. if you un-exclude a previously excluded directory, CLion will not only suggest updating the list, but also to reupload this directory to the remote host:
    Unmark Excluded

Unused Value analysis settings

The Unused Value inspection catches situations where a variable value is never used after it was assigned. However, there is a style when default variable initializers are recommended, even if they are not used afterwards. For example, you can also assign nullptr to the variables of pointer type. For those who follow this style, we’ve added an option to turn off the Unused Value inspection for the default variable initializers:

Unused Value

You can find it in Settings/Preferences | Editor | Inspections | C/C++ | Data flow analysis | Unused value. The setting is on by default.

And more

We continue to add MISRA C 2012 and MISRA C++ 2008 checks to CLion, and we’ve added more in this EAP build. The full list of currently available checks is here.

That’s it for now. The full release notes are available here. Try out the new EAP build today, and please share your feedback with us in the comments below or in our issue tracker.

DOWNLOAD CLION 2020.3 EAP

Your CLion team
JetBrains
The Drive to Develop

image description

Discover more