CLion opens 2016.3 EAP: user-defined literals, CMake output, C11 keywords completion and more
While we are still working on some changes in 2016.2 version and even backporting some compatibility fixes to 2016.1, this week we are also excited to announce the start of the Early Access Preview for CLion 2016.3, the third major update coming later this year. We have huge plans and are going to start right now with many new exciting features!
Download CLion 2016.3 EAP build 163.3983.6, give it a spin, and share your feedback with us in the comments section below and in our tracker – no active subscription required!
In addition to various bug fixes, this build includes:
- User-defined literals support
- C11 keywords completion
- Code generation attributes
- CMake output window
- Improvements for projects opened from symlinked directories
- Semantic highlighting
- Command-Line Source Code Formatter
- Version Control improvements
- User Interface changes (fonts and more)
User-defined literals (UDL) is a C++11 feature that brings the concept of built-in type into the language, allowing developers to define types out of integer, float, character, and string literals by adding special suffixes. This makes the code easier to read. The Standard Library uses user-defined literals in a few places like std:string, std::complex, and std::chrono.
So please welcome UDL support in CLion! Use STL literals or define your own and be sure no more false positive errors are shown in the editor:
Not only does CLion parse the user-defined literal, but it understands its type, as displayed in the Quick Documentation popup (
Ctrl+Q on Lin/Win,
F1 on macOS):
We plan to add a couple of smart actions for working with user-defined literals, including a quick-fix that generates a missing
operator"" (CPP-7538) as well as Rename (CPP-7453) and Inline (CPP-7540) refactorings. Share your comments in the corresponding tickets and upvote and follow them to get updates.
CLion 2016.2.2 added support for some C11 keywords including _Thread_local, _Alignas, _Noreturn, _Static_assert, and _Atomic. CLion 2016.3 EAP expands this by adding _Generic keyword to the list, as well as providing code completion for C99 and C11 keywords:
Code generation attributes
The behavior of Override (
Ctrl+O) and Implement (
Ctrl+I) actions has been updated to use the virtual keyword by default when needed. The override attribute can be selected as an option:
This helps avoid situations when both attributes are added automatically (CPP-416).
CMake tool window provides information on CMake warnings and errors (Problems tab) and CMake Cache variables (Cache tab). CLion 2016.3 EAP adds a new tab that contains CMake command output.
The tab provides several output logs, one per each CMake configuration. It can be used to track the progress and debug CMake scripts by checking the output messages from CMake.
When debugging CMake scripts, here’s one of the possible supported workflows:
- Run CMake reload.
- Check errors in the Problems tab.
- If an error is caught and the reason is unclear, navigate to the Output tab.
- Try to guess the problem source, make a fix, and re-run.
Projects opened from symlinked directories
Previously CLion had debugging problems with projects whose paths included symlinks. Now it handles such projects correctly, especially adding and stopping at breakpoints in project and library files. If you face any issues at all with such projects, feel free to share with us.
Some say developers spend most of their time reading code rather than writing it. Reading code is not the same as reading a book. Code is usually well-structured, and while reading it we pay attention to a selected set of primitives and structural elements. This makes it easier to understand the idea (the algorithm) behind the code.
Usual highlighting picks out language keywords, types and values. However, if you’d like to understand how data flow through the code, it makes sense to highlight each variable/parameter with its own color. That’s where semantic highlighting comes in.
CLion 2016.3 EAP comes with a possibility to switch on semantic highlighting in the editor:
- Go to settings Editor | Color & Fonts | Language Defaults.
- Go to Semantic highlighting settings and select the option Unique color for each parameter and local variable.
- Now you can configure start/stop points for the gradient. Variables colors will be distributed uniformly between these points.
CLion follows these simple rules with its semantic highlighting:
- Each parameter and local variable has its own color.
- CLion tries to keep colors unique inside the body of a function or lambda.
- Identifiers with the same name are assigned the same colors.
Try semantic highlighting in CLion today and let us know what you think!
Command-Line Source Code Formatter
Starting from this build, CLion comes with a command-line source code formatter (and so do IntelliJ IDEA and other IntelliJ-based IDEs). It can be used to format a set of selected files outside a project scope using an XML file with the exported code style settings. It’s available on Linux and Windows for now (macOS will join next EAP).
It can be used to format all files in a directory, or only those matching a list of file masks, or just a single file. Script should be provided with the code styles settings file in the XML format. The default code style is used if the file is omitted:
To export code style settings, go to settings Editor | Code Style, click Manage… and export the code style you prefer to XML. This file can then be provided as a parameter to the format script.
Version Control improvements
With the new version, you can safely undo certain actions with no harm to your project. First, undo the last change that you haven’t pushed yet via the Log’s context menu:
Second, restore a deleted local branch (or alternatively delete the tracked remote branch too).
Some projects require Git –signoff commits to be used (most popular use case is getting patches into the Linux kernel). It simply adds a line at the end of the commit message, which certifies the commit author and can be interpreted as a chain of responsibility for the copyright status of the code. You can now find this option in CLion’s commit dialog:
Find in Path
By popular request, we’ve changed the behavior of Find in Path so that it now preserves used previously settings, regardless of where you call it from:
San Francisco font for macOS
macOS users will notice that the default UI font is now San Francisco (SF NS Text). As the new standard for the macOS, it’s used across all the menus and tool windows both in the Default and Darcula themes:
Also, we are happy to share that the native file chooser on macOS is now back. Sorry for any inconvenience before!
Fira Code font
CLion 2016.2 brought support for font ligatures. Now we are happy to announce that CLion 2016.3 EAP bundles the FiraCode font that supports ligatures, so you don’t need to install it manually. To set is as your editor font, select it in settings Editor | Colors & Fonts | Font.
That wraps it up! The full release notes can be found here.
Your CLion Team
The Drive to Develop