Early Access Program News

CLion starts 2018.1 EAP: WSL support, C++17 if with initializer, CMake and project view changes

Hi all,

We are back from our holidays, and it’s time to start CLion 2018.1 EAP!
CLion_2018_1_EAP_blog@2x

Our plans for this release are really promising and today we are happy to present to you a couple of great new additions to CLion:

Download CLion 2018.1 EAP

Using Linux toolchain on Windows in CLion

If you develop on Windows but use Linux toolchain to build your project, you can now use Windows Subsystem for Linux (WSL) development environment support in CLion. After configuring WSL on your machine, you can simply select WSL in Build, Execution, Deployment | Toolchains, provide proper credentials and that’s it! Here you can find a detailed blog post about the configuration details (including a special script that can help you to configure the WSL in case a Ubuntu distribution is used and a list of current CLion limitations and known issues). There is a short video which demonstrates the setup and a working sample:
https://www.youtube.com/watch?v=xnwoCuHeHuY

C++ support improvements

If and switch with initializers from C++17

When you put an initializer before an if or switch statement, it pollutes the ambient scope, or you have to introduce an explicit scope to keep the code clean. C++17 allows adding an initializer to the condition in the if and switch statements, which is a much more accurate and cleaner solution. CLion now can parse and resolve such statements correctly:
if_init

Refactor hierarchies reliably

There was an issue with some rename and change signature refactorings that were not updating functions in other inheritance branches (so completely ignoring sibling functions). That made these refactorings unreliable in such cases. The issue is now fixed. For example, Rename updates all necessary functions in all branches:
rename

And more

As a temporary workaround until some critical issues with Unused import statement inspection are fixed, we’ve disabled it in the default inspection profile.

Besides this, the build fixes an issue with the incorrect severity highlighting (CPP-1795, CPP-8301, CPP-11257). Now, if you change the severity of the inspection (Error, Warning, Weak Warning, etc.), the color in the IDE’s right gutter will be updated accordingly.

CMake changes: open single file/open folder, load CMake

The process of decoupling CMake from CLion has started, and now you can open any folder or file in CLion (use File | Open menu or Open option on a Welcome screen). Be careful, CLion still needs a project to properly understand your code and provide you with smart features (like navigation, completion, refactorings, etc.). However, if you wish to open some C/C++ files in CLion for simply reading the code, that will be enough.

CLion will notify you that the project is missing and will suggest loading the CMakeLists.txt file:
no_cmake_project

Note, that the CMake tool window and CMake tools menu won’t bother you until you load a proper CMake project in CLion – they all are hidden. When you select a CMakeLists.txt file, CLion will load it as a project file. If you select the wrong CMake file by mistake, you can always call Tools | CMake | Unload CMake project action.

There is also an important note about project root – when you load a CMake file into CLion, a directory containing this CMakeLists.txt is considered a new project root directory. You’ll see an IDE notification if it’s not matching your currently opened directory and you can change it via Tools | CMake | Change Project Root.

Alternatively, you can create a new CMakeLists.txt from scratch via Create New File (Alt+Insert on Windows/Linux, ⌘N on macOS):
new_cmake

For your convenience, there is a new file template for CMakeLists.txt file available in CLion, which you can edit in Editor | File and Code Templates.

Scopes in Project View and Find in Path

CLion 2018.1 EAP includes the ability to use scopes to filter the project view and limit a Find in Path search. CLion comes with a few predefined scopes. For example:

  • Project Files – all files within the project root, w/o the excluded folders
  • Project Source Files – Source files from the CLion perspective (all intellisense features work)
  • Project Non-Source Files – Files located in the project directory, that are not sources from the CLion perspective, which means files that are not included into the loaded CMake (intellisense features are disabled)
  • Problems – currently empty, will show analyzer errors later (CPP-11252)
  • Changes files – in case of VCS, all changed files

Users can also create their own scopes to use in the Project View and Find in Path.

By default, Project View opens Project, which includes all project files, including generated folder (like cmake-build-debug) and other excluded folders:
project_view

In the dropdown you can now select any predefined or custom scope:
Project_view_selector

In case you select any scope different from Project, in the context menu, the Edit Scopes action becomes available. It allows you to create and configure custom scopes:
configure_scope

You can use it later in Project view:
custom_scope_view

Mind that the colors have changed: source files became blue (previously not greyed out), non-source files now have regular colors (previously greyed out).

All predefined and custom scopes are also available in Find in Path to help you limit the search:
find_in_path_scope

Performance improvements: incremental highlighter

When you edit code inside a small function body in a huge file, you will now notice a significant performance boost – CLion updates the file highlighting incrementally, and local changes (in a function body) don’t affect the whole file highlighting.

Objective-C/Objective-C++ support

In this EAP we enabled Objective-C/Objective-C++ support in CLion. Which means it’s now possible to work with files in these languages which are added to your CMake project. The following features are now available in CLion:

  • Full Objective-C/Objective-C++ languages support coming from AppCode
  • All Objective-C inspections from AppCode (with the except of clang analyzer set)
  • Key-value coding support
  • Objective-C live templates, as well as File and Code templates for Objective-C
    .m/.mm file extensions in the list of C/C++ source files extensions
  • Code style/color schemes, however one needs to enable this in the Registry in clion.enable.objc.settings

MSVC

If you have Microsoft Visual C++ compiler installed on your machine, you can use it in CLion. And from now you don’t even need to turn on Registry setting for this. The functionality is available on Windows by default. Go to Build, Execution, Deployment | Toolchains to select VS development environment.

That’s it! Full release notes are available by the link. Download and try the build (181.3007.15) right now and share your feedback with us!

Download CLion 2018.1 EAP

Your CLion Team
JetBrains
The Drive to Develop

Discover more