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.
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.
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:
- 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.
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:
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!
Your CLion Team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
CLion 2023.3 Release Candidate
CLion 2023.3 is on its way, and the release candidate for v2023.3 is already available! To install CLion 2023.3 RC (build 233.11799.171), download it from the website, update via the Toolbox App, or use this snap package (for Ubuntu). You need an active subscription or a trial license to use CLi…
CLion Nova: A New Update With Various Bug Fixes
CLion Nova, a free preview of CLion with the ReSharper C++/Rider C++ language engine, was announced recently. We’re excited to see how well you liked the first build! There are about 3,700 users right now and the overall feedback is mostly positive, especially that which is related to performance an…
CLion 2023.3 Goes Beta
The Beta version of CLion Classic 2023.3 is now available with key improvements and changes that are expected in the upcoming release. Download build 233.11799.37 from our website, via the Toolbox App, or as a snap package for Ubuntu. If you are using CLion Nova, note that we do not plan to release…
CLion Nova Explodes onto the C and C++ Development Scene
TL;DR Today, we’re announcing a free early preview of CLion, which uses the ReSharper C++/Rider C++ language engine instead of the CLion "legacy" engine. The Preview build is available via our dedicated Toolbox App feed. At some point in 2024, depending on the results of the feedback coll…