CLion 2018.2 EAP: clangd as an additional C++ language engine
Hi,
A new CLion 2018.2 EAP (build 182.3458.13) is now available! As usual, a patch-update will be available shortly for those using the previous EAP build, and you can also use Toolbox app or snap packages (in the case of Ubuntu) to get this build.
No license is required and the build is free to use, but it will expire within 30 days of the build date.
In brief, in this build clangd is available as an additional C++ language engine in CLion. It’s turned on by default on all platforms (on Linux and macOS – in v2018.2, on Windows – in v2018.2.1) and is used for showing code errors and warnings in the CLion editor. This feature is experimental, which means we can not guarantee it will make it to the official CLion 2018.2 release.
And now let’s talk about it in details.
Intro
CLion provides rich code insight abilities for C and C++ code. All these refactorings, code completion, code generation, code analysis, and other features are working on the language engine which CLion provides. We constantly work on making the language support in CLion more accurate and knowledgeable about modern C++ language features. As part of this goal, we now would like to give clangd, a popular Clang-based language engine, a try as an additional C++ language engine.
Two is better than one
Nowadays Clang is definitely the most accurate solution in terms of correct C++ code parsing and resolve. However in its current state it can’t support all the code insight features we’d like to provide in CLion. So we’ve decided to keep both language engines working at the same time.
How my IDE is affected?
Let’s talk about how the change affects CLion:
- When enabled, clangd is used to show code errors and warnings in the CLion editor. CLion’s own code errors are turned off in this case (some warnings are still there).
- Default configuration includes many compiler warnings, unless you turned them off manually in settings.
- Quick-fixes are provided by the CLion’s own engine.
- The rest of the code insight features are not affected (i.e. code highlighting, refactorings, completion, navigation is still working on top of the CLion’s own language engine).
Available settings
Clangd settings are available in Settings/Preferences | Languages & Frameworks | C/C++ | Clangd:
Here you can turn on/off the clangd as errors/warnings provider and configure the Clang warnings set.
Known issues and limitations
Here is the list of the issues and current limitations known to us. If you notice anything else disturbing you, please report to our issue tracker.
- In some cases the quick-fixes might be provided by CLion with a noticable delay after the error shown by clangd.
- Code | Inspect Code… action uses CLion C++ language engine. So the result may be different from what you see in the editor (as it works via clangd).
- Complete Statement for incomplete code doesn’t work in most cases when errors from clangd are enabled (CPP-13412).
- Some other issues: CPP-13312, CPP-13482, CPP-13484.
Full release notes are available by the link.
Your CLion Team
JetBrains
The Drive to Develop