Last September, we were pleased with the news about the start of the Public Early Access Program of our new cross-platform IDE for C and C ++ development - CLion. And today we are ready to say - the release of CLion 1.0 has taken place! Two years from the first (half-joking) announcement of the start of C ++ IDE development, we have come a long way - we rethought our skills and abilities to work with C ++ code, we learned CMake together, expanded the team, tested CLion on dozens of large C and C ++ projects.
But the most important thing is the daily support of the C ++ community, which (thank you!) Received us very favorably. Thanks for the words of support, bug reports, suggestions for new features, hundreds of retweets and reposts of our news and announcements! Today we are ready to show you and tell you what is included in CLion 1.0.
Languages, platforms, tools
Some of you already know that support for development in C and C ++ is offered by three of our products at once - ReSharper C ++ , AppCode and CLion itself. CLion is focused on cross-platform development using GCC or Clang (for Windows, you need Cygwin or MinGW for this). CMake is used as a design model, GDB is used for debugging. This set will probably change in the future - we plan to support other build systems (Makefiles, qmake, etc.), and use LLDB for debugging. For your convenience, the assembly CLion includes CMake 3.1.3 and GDB 7.8 (an exception is the case of using Cygwin - there GDB is not included in the assembly CLion). If these versions do not suit you, you can easily change to any other versions of the corresponding tools - in the settings you need to open Build, Execution, Deployment | Toolchains and specify the path to the desired versions. There is also a small test for the specified set of tools - if everything is in order, you will see: ')
CMake support
As mentioned above, CLion uses CMake as a design model. All the information about which files are included in the project, which C ++ standard should be used, which libraries and compilation flags will be used, etc. CLion takes it from CMake. So far, little of this has been rendered into a separate UI:
There is also a special window for editing CMakeCache settings.
If you already have a CMake-based project, to start working with CLion, simply open the top level CMakeLists.txt in IDE. If not, then you can try importing the project in CMake using File | Import Project ... CLion will help create the simplest CMakeLists.txt.
For easy editing of CMake files, autocompletion of CMake commands works:
It also comes in handy with single-line (using Ctrl+/ on Windows / Linux, ⌘/ on OS X) or block commenting ( Ctrl+Shift+/ on Windows / Linux, ⌥⌘/ on OS X) in CMake files. All changes can be applied right there automatically, allowing CLion to overload the project automatically after the changes.
For each target, CMake CLion creates a configuration that can be built and run (in case an executable file is specified). The executable file can be changed in the configuration settings in Run | Edit Configurations ... This can be useful if you want to specify an executable file for the all configuration, available by default. When adding new files and C ++ classes to the project via the New context menu, CLion offers you to automatically update the CMake targets — you will be shown a list to select the required one (s).
Smart features
Built on our open IntelliJ platform, CLion includes many traditional smart features that help developers be more productive:
smart auto-completion with filtering by type and using Camel Case / Snake case / Middle matching;
auto-formatting code, style settings;
Quick keyboard shortcuts for almost all actions and commands. Standard layouts IntelliJ IDEA, Emacs, Visual Studio, Eclipse, NetBeans, Xcode, ReSharper, as well as the ability to customize the layouts;
Search for using a symbol, and not a text one, but using the current context, you can also search for a symbol in lines and comments;
navigating by the name of the symbol / class / file, moving up / down the hierarchy, moving to the definition / declaration;
various modes of viewing and navigating through the structure of the code - according to the structure of the current file, according to the hierarchy of types / calls / include;
code bookmarking system, TODO (CLion will even warn you if you forget to finish some task in the code marked TODO before committing the code to the version control system);
code generation: forgotten or not yet implemented functions, members of parent classes, constructors, get / set functions for class fields - CLion will help to generate all this in one click;
Surround with and live templates will help you quickly wrap selected lines of code in if , while , for , #ifdef , etc., or generate an iterator over the collection;
Refactoring
Of course, CLion has a lot of refactorings that automatically update all the necessary places in your code:
Rename - when renaming, CLion will be able to take into account not only the context of the symbol, but also its use in lines and comments;
Change Signature - using this refactoring, you can add / remove parameters, change their order (the order of arguments in function calls will also be updated automatically), change the type of result;
Move, Copy, Safe Delete - are indispensable for safe work with project files;
Inline - removes an extra variable or function call, replacing them with the immediate value / function code;
Extract Variable / Constant / Parameter / Typedef / Define - not only add a new variable, type, constant or macro with a new name, but also give the opportunity to put a definition in the header file and declare a new constant static. When finding similar values elsewhere in the code, CLion will offer to substitute a new variable / type / constant / macro not only in this place, but also in similar uses:
Extract Function - CLion will automatically determine which parameters should be passed to the input of a new function, and which value should be given to the output, substituting the necessary values when used;
Extract Superclass / Subclass and Pull Members Up / Push Members Down - these two pairs of refactorings will help with the reorganization of the class hierarchy in your project; for convenience, autocompletion works in the corresponding dialog to search for the desired class by name.
Code analysis
CLion not only gives you the opportunity to write code, but also tries to literally understand what you have written, and whether there are any problems in this code. By analyzing the code on the fly, not only potential problems are highlighted, but methods for fixing them (quick-fixes) are immediately suggested. CLion provides over 40 C and C ++ code inspections, including searching for unused code; missing cases in switch-case statement; creating variables that overlap other variables available in the same context, with the same name; search for infinite recursion and infinite loops (here CLion uses full Data Flow Analysis); type inconsistencies, etc .:
Debugging
Built-in debugger (using GDB) will help to thoroughly understand the code. There are several types of breakpoints available in CLion:
Line breakpoints are the simplest and most frequently used, easily installed and removed by simply clicking on the left vertical marker bar next to the editor window;
Symbolic breakpoints - are needed when you want to stop at some library function or call, the code of which is not available or it is difficult to define a line for a breakpoint of the first type;
Exception breakpoints - as the name implies, are designed to intercept and stop at the time of throwing exceptions.
During debugging, the immediate values of the variables will appear in the editor (directly opposite their declaration), and the debugger window will allow you to view the values of the variables, add watches, and run any command in the GDB console. You can also calculate the value of any expression during debugging, and autocompletion will help in writing the expression that interests you directly:
And finally
CLion, like our other IDEs, includes integration with various version control systems (Subversion, Git, GitHub, Mercurial, CVS, Perforce, TFS) and bug trackers (Jira, YouTrack , PivotalTracker, Bugzilla, and many others), stores local history . Many additional functions are available through the plugin system: for CLion there are already about a hundred.
And for those who are accustomed to a simple console and vi, there is a built-in terminal and an IdeaVim plugin for emulating Vim mode.
And on May 6, 2015 we will hold a free webinar , where we will show the most interesting features of CLion. Sign up today! During the webinar, you can ask questions. We will try to answer them on the air, and what we do not have time - we will answer in the mail and blog.