CLion 2019.1 is Here with Embedded Development, ClangFormat, Memory View, Injected languages, Custom Themes, and Much More

We’ve got great news for you! This year’s first major update, CLion 2019.1, is public!

To update right away, use the Toolbox App, snap package (on Ubuntu), our website, or the patch-update from the latest build of 2018.3. What are you waiting for? :)
CLion 2019.1 released!

As announced earlier, our main areas of focus this year are IDE performance, expanding Clangd leverage, and Embedded Development. This update makes headway in all three areas:

Read on for more details and check out this short What’s New video by Phil Nash:

We can provide you with a free 30-day trial to test out all these features for yourself before committing to a subscription.


Wider integration with the Clangd-based language engine

As our main focus on wider Clangd integration hasn’t changed, we devote a lot of effort to developing our complementary Clangd-based language engine. Where possible (from the functional and performance point of view), we reimplement actions on this engine, still leaving the option (for now) to switch to CLion’s own engine for such actions.

From a user’s perspective, we see that it makes the editor more responsive. Another step we’ve taken towards wider Clangd integration is that we now leverage Clangd to identify places that need quick-fixes. This means that the Clangd-based language engine can not only be used to identify potential breaches in the code and show an error or warning, but also to provide the location for a quick-fix. Note though that the actual quick-fix is provided by CLion.
Clang fix location

This second step however had some drawbacks, and as a consequence a few of the quick-fixes were temporarily removed (CPP-15243).

Amongst other things, the error-annotator has been improved, and can show more detailed error message taken from Clang. Useful cases for this includes debugging a failed overload resolution, where Clang can provide a detailed reason for the substitution failure:
Clang errors

Our C++ language support team is also working on the unique code checks provided by CLion and implementing them on Clangd. This time the Member function can be static check. It analyzes the method body, trying to check if it depends on this or not:
Member static

Improvements for CLion’s own language engine

IDE performance

Even as we are working on the Clangd-based engine, we’re still investing lots of effort into improving our own language engine. First, we aim to boost the IDE’s performance, where Clangd is not yet applicable, and second, we increase the accuracy of the refactorings, which still cannot be moved to the Clangd-engine, at least not in its current state.

Importantly, we’ve reduced the initial indexing times when you create a new project or open one for the first time. The idea is that CLion can now reuse the symbols built already for some other recently opened projects, as long as they fit for this project. A typical case is with STL or Boost libraries, or any other custom library you are widely using in your current and new projects. We plan to work further on this feature and expand on it in the future.

More accurate refactorings

We have been going through and updating the refactorings one by one, and this time we got to work on Extract. To make sure the result is accurate, we worked on making it respect the std:: namespace qualifier, template specialization and template parameters, and type aliases.

The Rename refactoring has also had some special attention given to it. Now the Rename called on a file doesn’t silently trigger the associated class/struct rename, but instead shows a popup suggesting this option. And vice versa!
Rename class

Besides, when the header file is renamed, the header guards are updated accordingly if they are used in this header file and the header guards style template used includes the header file name.

First steps towards Embedded Development

If you develop for STMicroelectronics boards, you’ll be happy to find that CLion now integrates with STM32CubeMX:

  • CLion’s new project wizard suggests you creating an STM32CubeMX (.ioc) project or you can open an existing project of this type in CLion.
  • Later you can start STM32CubeMX directly from CLion at any time to update board settings and generate code.
  • CLion will also generate a corresponding CMake file for your .ioc project to work with it correctly and suggest selecting the board config.

If you’ve ever tried the OpenOCD + STM32CubeMX plugin, the functionality is very similar as we now bundled the updated version of this plugin into CLion.

The second part of the plugin can be useful to any embedded developer, as it provides the integration with Open On-Chip Debugger. Use the new Run/Debug configuration template, ‘OpenOCD Download and Run’ to debug on your microcontroller.

Learn more about the integration and necessary setup in this detailed blog post.

Adjust CLion to your code style


The ClangFormat tool is widely used in the C/C++ world and is even regarded as a standard by many developers. Quite often open source projects store a .clang-format config file in their repository. Now, when you open up such a project in CLion, the IDE will detect the config file and will suggest that you switch to ClangFormat. Which means, ClangFormat is now integrated into CLion as an alternative formatter! It affects all the IDE’s actions, so you can switch to it completely.

There is also a general per-IDE switcher for ClangFormat in Settings/Preferences | Editor | Code Style. Read all about it in our dedicated blog post.

C/C++ naming

PascalCase for classes and structs, camelCase for member functions and variables, SCREAMING_SNAKE_CASE for macros and constants, snake_case for global functions, ‘E’ as a prefix for all enum types – all these naming conventions. CLion understands your pain and now provides the corresponding settings in Settings/Preferences | Editor | Code Style | C/C++ | Naming Convention and respects the selection in all completion, code generation, refactoring actions, and quick-fixes.

You can also select a naming style (and other code style settings) from a predefined scheme: Google, LLVM, Qt, and others are available. Or, you can enable the Inconsistent Naming inspection to have the IDE warn you about any problematic names and then give suggestions for a more accurate name with a quick-fix to replace all the usages for you.
Naming convention

Header Guards style

What do you usually use in header files – pragma or header guards? By default, CLion generates header guards (you can change the header file template to use pragma in Settings/Preferences | Editor | File and Code Templates), if you are a header guard kind of person, then you’ll be happy to know that CLion 2019.1 comes with a new ability to configure the header guards style:
Header Guards settings

The template supports Apache Velocity syntax and uses some predefined variables such as ${PROJECT_NAME}, ${PROJECT_REL_PATH}, ${FILE_NAME}, ${EXT}, etc. If you wish to use a more standard style, select one of the predefined styles option (same as for the naming conventions).

Custom build targets and run/debug configurations

Many of you have been asking us recently to provide you with the ability to build projects using some kind of custom command provided in the IDE. There have also been a lot of requests for the ability to run/debug binary in the IDE by pointing a Run/Debug configuration to the custom executable. This would be especially useful for compilation database projects, which are supported in CLion (and can be extracted from nearly any build system). So in CLion 2019.1, this is exactly what we have done.

To build your project with a custom command, create a Custom Build Target in Settings/Preferences | Build, Execution, Deployment | Custom Build Targets, where provide a toolchain and Build/Clean commands:
Custom target

To run or debug a custom configuration in CLion, configure the Custom Build Application configuration in Run | Edit Configurations…, where you can provide a custom target, executable, the program arguments, etc.
Custom configuration
Learn more about the details of how this all works in our webhelp.

Debugger enhancements

Memory view

Starting from CLion 2019.1, you can dump the raw memory behind a pointer when you are debugging. There is even more to this: open the memory view while debugging and follow the changes to the memory during stepping:
Memory View

This is still a work in progress. For example, you can expect the ability to dump the arbitrary memory address in the Debug mode coming soon in the updates.

Disassembly view

The Disassembly view has been improved to show the information there categorized by function. And it now works for LLDB, so LLDB and GDB are both covered now.
Disasm view
Use Force Step Into (Shift+Alt+F7 on Win/Lin, ⌥⇧F7 on macOS) on a function with no source code to open this view:

Mute variables

Variables can take a significant amount of time to calculate, and this may be especially performance-critical when stepping through the code. If you need to keep an eye on the variables calculations, it can be a huge amount of work and may not even be needed in the end. In such situations, you can now Mute variables using a general per-IDE switch. And when you do need to, you can apply the Load option to calculate the particular variable on the current step.
Mute variables

Injected languages

String literals with pieces of code can be treated as real code pieces. This means that code highlighting and language-specific intentions and actions can be applied to them. Typical examples where this could be useful would be SQL or HTML strings, or regular expressions.

To temporarily inject a language, press Alt+Enter and apply the intention “Inject language or reference”, select the appropriate language, and you are done! Now you can edit code fragments in the dedicated editor section or apply a specific action, for instance, you can check whether a string matches the RegExp right in the IDE:
Inject language
Isn’t that handy?

Brighten up your IDE with custom color themes!

If the Default white and Darcula themes are not enough for you, then why not go ahead and create your own custom one! Every color of every item in your IDE, from the icons and radio buttons all the way through to the arrows, are now all totally configurable. Adjust them to your own personal preferences and then save it all as a new theme plugin. Learn how to do it in this tutorial.
Color themes

Rust plugin update

The IntelliJ Rust plugin provides support for Rust along with the Cargo build system and debugger in CLion. This version gives it a massive update:

  • Profilers are now supported for Rust: DTrace on macOS and Perf on Linux.
  • Out-of-scope items are suggested in code completion and trigger the auto-import when used.
  • Rust language injection into code snippets in doc comments is now provided.
  • Various improvements to Cargo check annotator and LLDB and GDB formatters.

Stay tuned for a detailed blog post on the recent changes (or subscribe to our Rust news here in the blog).

Other enhancements

Other improvements include a new Recent Locations popup, which provides an overview of all the locations that you’ve visited in chronological order, and an updated versions of bundled CMake (3.13), the bundled LLDB (7.0.1), and the latest supported Cygwin (3.0).

Besides, the process of building CLion’s plugins was simplified by publishing CLion as a Maven dependency to be used by gradle-intellij-plugin (since version 0.4.2).

That’s it! Please go and give all the new improvements a try and let us know what you think.


image description