CLion 2018.3: remote development, code profiling, speed, and more

    Hi, Habr!

    The other day we released the CLion 2018.3. The third major release this year sums up our work in two important areas of development - language support and remote development .

    In addition, we finally:

    • added code profiling tools;
    • reworked commands in the editor to build / rebuild code at the level of a single file, several targets, or the entire project;
    • together with other IDEs based on the IntelliJ platform, added support for Git submodules and GitHub pull requests;
    • improved means of universal access to IDE (accessibility) features.

    image

    Read more about these and other innovations below. And to try new features and improvements, download the free 30-day version from our website .

    C ++ language support


    More C ++ 17


    The CLion parser has learned to understand two new features of the C ++ 17 standard - fold expressions and deduction guides . On the one hand, changes in the parser are not yet full support, but, at a minimum, the code highlighting will be more correct, and for cases the user-defined deduction guides IDE will even correctly display the type and can be seen, for example, when calling function parameters.

    image

    Clangd is now in navigation


    Last time we wrote that CLion now uses not only its own language engine for working with C / C ++ code, but also one more additional, experimental one, made on the basis of Clangd. Turning it on to display errors and warnings in the editor, we moved on and in CLion 2018.3 implemented some code navigation and search in code based on it.

    The language engine based on Clangd provides the results, which are later combined with the results obtained from the CLion own engine. A typical example is Find Usages ( Alt+F7): according to the files opened in the editor, Clangd performs the search, and the others use our own engine.

    Examples of other actions where the language engine on Clangd is additionally used:

    • Go to declaration ( Ctrl+B/ ⌘B) / Go to definition ( Ctrl+Alt+B/ ⌥⌘B)
    • Highlighting all the inclusions of the character at the cursor
    • Quick Documentation ( Ctrl+Q/ F1)

    Clangd is enabled by default and is configured in Settings / Preferences | Languages ​​& Frameworks | C / C ++ | Clangd:

    image

    That is, you can independently enable / disable the necessary functionality on top of Clangd - for example, just showing errors or just navigating. If you need to completely disable the use of Clangd, uncheck all the checkboxes in this dialog.

    And, by the way, Clang-Tidy is quite possible to run without Clangd, but launching through Clangd significantly improves performance, since it uses the AST tree cached in Clangd.

    Remote development


    In the release of CLion 2018.1, an opportunity has appeared on Windows to work with the Windows Subsystem for Linux (WSL) subsystem. This Linux environment built into Windows allows you to build, run, and debug Linux applications on Windows. We then said that we specifically implemented WSL support via ssh, that is, as a remote subsystem. This was the first step to working with completely remote configurations.

    And in CLion 2018.3 we announced support for the first large version of remote development:

    • On the local machine where CLion runs, it can be Linux, Windows or macOS.
    • On a remote machine, where CLion will build your application, run and debug it, run tests, for now there can only be Linux.
    • It is assumed that the code is on the local machine. CLion itself synchronizes it to the remote machine, and back to the local one pulls out the header search paths for quick rezolv code in the editor. Synchronization is done via rsync for Linux or macOS as local machines, and via sftp and gzip for Windows.
    • It works so far only for projects on CMake.

    image

    Setting up such a remote configuration is very easy - you just need to create a remote toolchain in Settings / Preferences | Build, Execution, Deployment | Toolchains and use it in some CMake profile. Detailed instructions are in our English-language blog and online documentation . Synchronization progress with a remote host is displayed in the File Transfer window (View | Tool Windows | File Transfer), and the connection settings and directory paths on the remote machine are changed in the Settings / Preferences | Build, Execution, Deployment | Deployment.

    A lot of work is expected in this direction. Now, as you can see, the options for locating the code directly on the remote machine are not supported, there is no support for the remote version control system, there is no integration with the remote terminal, and there are many minor flaws in installing the connection itself. But the main thing is - remote development with CLion is now possible!

    Custom code performance analysis


    CLion 2018.3 provides an opportunity to analyze the performance of the code. On Linux - Perf integration is provided , on MacOS - with DTrace . The new action is available in the Run menu, in the navigation bar and in the context menu of the application launch icons. Code profiling results are available in the CPU Profiler window (View | Tool Windows | CPU Profiler).

    image

    Details about what you need to install on your computer to earn profiling code, read the blog or online documentation .

    It is worth noting that the UI / UX is still somewhat experimental. It is planned to significantly improve it in versions 2019.x. But there are already useful things, like the ability to see all threads together or one by one, the ability to navigate to the source code, etc.

    Build and Rebuild Commands


    The number of various combinations of build commands has grown so much that we decided to bring them all to a separate menu item - Build. There you can build / rebuild the entire project, and the target allfrom all or from the selected CMake profile, and the selected configuration, and one specific file:

    image

    This is, of course, for CMake. For the compilation database, there will only be a reassembly command for a specific file.

    Universal dialogues: Run Anything and Search Everywhere


    Double ShiftCLion users have been familiar with the Search Everywhere ( ) dialog for a long time, as with the Find Action ( Ctrl+Shift+A/ ⇧⌘A) dialog for finding a command or setting by name, and with navigation dialogs to a file, symbol, or class by their name. And now this is, in fact, the same dialogue!

    image

    Separate dialogs turned into separate tabs, switching works through Tab. At the same time, we have eliminated a number of problems associated with these dialogues, including the loss of focus and incorrect dimensions.

    Another new universal dialog is Run Anything ( Double Ctrl). From there, you can start the application in normal mode or from under the debugger, and also open any project:

    image

    Checks in сompilation_database.json


    Compilation database is an alternative project model that CLion has been supporting for some time. It is very convenient in that you can get it from virtually any other design model, popular or even custom. CLion can open projects from the compilation database, parse the code correctly and provide all the smart tools for working with the code. The only drawback is the lack of information about the assembly of the entire project in this format, so gathering only individual files from the IDE so far.

    In this release, we added a schema for the compilation_junction.json files to CLion, and based on this schema, we implemented checks in the file itself. For example, an incorrect type of value is correctly or completely missing:

    image

    Checks can be very useful if you decide to write such a file with your hands or correct an existing file.

    Editor performance and tests


    In many of the dumps from our users, it was clear that the significant performance problems of the IDE are related to how the IDE determines the list of tests available in the project. In version 2018.3, we made this process lazy, and now, if you have not opened a single test file in the editor, they will not be indexed. In addition, performance improvements were made when navigating to test results, auto-completion of test macros, etc.

    Editor improvements


    As you know, in the Quick Documentation ( Ctrl+Q/ F1) window, CLion can display not only documentation and code comments, but also derived types for variables and the final substitution in macros. This final substitution is now formatted, and keywords are highlighted in it. It is very convenient for complex macros with several levels of attachment, for example for Boost:

    image

    Comments TODO can now be made multi-line, the main thing is to indent the second and subsequent lines - CLion will automatically understand that this is part of the TODO comment:

    image

    There are users for whom standard themes are not convenient, as they do not have sufficient contrast. For them, we have added a special High-contrast Theme. It can be enabled only in the code editor (Ctrl + `) or for the whole IDE (Settings / Preferences | Appearance & Behavior | Appearance | Theme).

    image

    Together with the IntelliJ Platform, we reworked the plug-in settings menu in the IDE (Settings / Preferences | Plugins). It is now much easier to keep installed plugins up to date, and also to sort and filter a huge repository of existing plugins for IDE.

    Version Control System


    Another important platform change is the long-awaited support for Git submodules . Now all operations for working with VCS in CLion take into account submodules as well: cloning a project, updating it, comparing versions (diff), etc.

    A GitHub Pull Requests window has been added , in which you can not only view all pull requests, but also search / filter them by author or condition. And you can also create a new branch from any pull request literally in one click.

    Demo


    Traditional video about the new features of CLion 2018.3 in English:


    What next?


    Next year we plan to continue working on the second additional language engine based on Clangd - let's see what other IDE features we can implement on it. We will improve the performance of the editor, finish and improve the existing features; Particularly diverse is the work of supporting remote development in CLion. From integrations we plan clang-format and, probably, this or that debugger for Windows / MSVC.

    A key focus for us will be Embedded development . More recently, Elmot , the author of a very popular plugin for support in CLion OpenOCD + STM32CubeMX, joined our team .. Ilya will continue to integrate this functionality into the IDE, we are planning to finish the memory view as soon as possible and redo the hex view.

    Questions, suggestions, bug reports and just thoughts expressed in the comments! We will be happy to respond.

    Your Team JetBrains CLion
    The Drive to Develop

    Also popular now: