Early Access Program News

CLion 2019.1 EAP: naming conventions


Here comes a new CLion 2019.1 EAP build 191.5532.20! Get it from our website, Toolbox App, or via a snap package (if you are using Ubuntu). The patch will be available shortly if you are using the previous EAP build.

Download CLion 2019.1 EAP

Naming Convention

Naming is a non-trivial decision every developer makes daily. It can improve the readability of our code or ruin it completely. This is why naming conventions have been created: to help developers follow standard paths when selecting names for various identifiers such as global/local variables and functions, types, parameters, classes, and so on. Known libraries, game engines, and other notable pieces of code usually follow some predefined schemes their authors agree on and recommend that all contributors use as well (if the project is open source).

We’ve recently asked our followers on Twitter: “Which naming styles do you usually use in your C++ projects?”. The answers were very diverse; here are just a few:

The reason we asked is, obviously, our desire to improve CLion and help our users keep the preferred naming convention. This EAP showcases our first steps in this direction.

We keep listening to your feedback on Twitter and in our issue tracker (check the subtasks under CPP-15439) and plan to improve this area further before the 2019.1 release.

Let’s see what great new things you can do in CLion!

How to configure? Code Style settings

A new tab is now available in Settings/Preferences | Editor | Code Style | C/C++, called Naming Convention. Here you can configure the preferred style for namespaces, macros, classes, enums, functions, parameters, etc.

You can select the style (lowercase, camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, or UPPERCASE). You can also set a custom prefix or suffix (for example, you can use ‘E’ as a prefix for all Enum types).

Most likely we’ll be adding more options here – for example, it’s already obvious that template parameters are currently missing (CPP-15445). Note also that the settings are global per IDE for now. If project-wide settings are important to you, feel free to up-vote CPP-15446.

You can also select the naming style (and other code style settings) from the predefined scheme:

Note that these schemes are used for indents, spaces, and other formatting options at the same time, so not all of them actually include any naming rules. We may add more schemes in the future.

How does CLion respect the naming style?

CLion respects the naming settings provided and uses them in the following features:

  • Autocompletion.
  • Code generation, including live templates.
  • Extract/Inline function and Introduce define refactorings.
  • Quick-fixes which generate code, such as add parameter to constructor, change function signature according to call, and some others.

naming quick-fix

In addition, if you’d like CLion to enforce a naming convention more actively, turn on the new Inconsistent Naming inspection (Settings/Preferences | Editor | Inspections | C/C++ | General). CLion will highlight the problematic names and will suggest a quick-fix to replace all usages with a more accurate name:
naming quick-fix

Other improvements

More notable changes in this EAP build include:

  • For those who use Remote Development mode in CLion, IPv6 is now supported. Please check the corresponding ticket (CPP-14264) for details on how to enable it.
  • CMake 3.13.4 is bundled.
  • We do recommend that our users use the experimental Clangd-based language engine (turned on by default). However, if you experience any issues with it, you can now easily turn it off: use Enable clangd server in Settings/Preferences | Languages & Frameworks | C/C++ | Clangd. And please don’t forget to report any issues you encounter with all the logs to us.

That’s it. The full release notes are here. Download and try the EAP build today. We are looking forward to your feedback!

Download CLion 2019.1 EAP

Your CLion Team
The Drive to Develop

image description