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 Shift+Ctrl+D on Windows/Linux, ⇧⌘D on OS X.
  • From the generate menu (Alt+Insert in Windows/Linux, ⌘N on 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

This entry was posted in Early Access Preview and tagged , , , , . Bookmark the permalink.

29 Responses to CLion 1.5 EAP: new code generation possibilities and improved auto-import

  1. Anton says:

    Guys, you did a great job and the current features we have are simply fantastic. But please, fix the debugger integration. Without a working and responsive debugger, CLion can’t be used as a full-featured IDE. For almost a year in my everyday work, I periodically fallback to another IDE. It’s not as cool and convenient as CLion, but it’s very fast and just work as it should. You have almost reached a 1.5 milestone and IDE should have a working debugger at this point.

    • Anastasia Kazakova says:

      We do work on debugger continuously and many fixes were included in the previous EAP builds. Hope to have more soon. Thanks for support!

    • Leo says:

      I second that. What I also do not fully understand is why the integrated debugger component cannot work with a remote target. Its not like gdb would behave so much different connecting to a gdb server than locally.

      • Anastasia Kazakova says:

        It’s not about GDB of course, but about CLion supporting this at its side. We hope remote debug will come soon.

  2. Yury V. Zaytsev says:

    I see a lot of progress on the variadic front, hopefully the regressions will be killed before release, and maybe finally will come the time of C++14. Yay! Before CLion got support for variadics, a lot of inspections were missed just because it didn’t understand the code, but now it does, and it currently applies C++11 profile even with -std=c++14, which makes things redder than ever…

    On a related note, I find it really to be a huge pain to re-type the error messages shown upon pressing Ctrl+F1 when reporting bugs, especially if the long / complicated types are involved. Is there anything that can be done about it? Some magic to copy the messages to clipboard directly? It’s just so depressing to rekey all this stuff…

    • Anastasia Kazakova says:

      Thanks for your support. Yes, many issues are already fixed and many are in progress currently.

      Regarding the messages, I’m afraid no, except for workaround – running code analysis on a file (run inspection by name or just all inspections on a file via Code | Inspect Code…) and find proper one in the list afterwards.

  3. Ivan says:

    I have also noticed that updating symbols on the project takes about as long as building them from scratch. At least I observed this on heavily templated projects.

  4. Roman says:

    Code completion does not work in this build in most of cases for my project. Tried re-parsing project, and invalidating caches. Didn’t helped.

    • Roman says:

      Oh, I got it: looks like it now takes ~ 20 seconds to show list of suggestions, used to be less then one second.

      Unfortunately, when you got smarter, you become slower.

  5. David Weisgerber says:

    I love working with CLion at the moment using version 1.2.4. However, there is one major use case where I cannot use it at the moment:
    There is no Visual Studio Compiler/Debugger integration for Windows. I hope you can fix this soon as I need this for most of my projects.
    In addition, it would be nice to have some degree of Qt support (specially for the debugger).

  6. Lectem says:

    Sadly I still have issues with auto-import, using mingw-w64. for example map/unordered_map/vector will still try to include c++/…/bits/…h

  7. Sebastian says:

    I’m no longer getting “add method” suggestion – the popup menu only contains the “Cannot resolve” option. I’ve invalidated the cache and reloaded cmake project but nothing changed. Using 2016.2 EAP on arch linux.

Leave a Reply

Your email address will not be published. Required fields are marked *