Clion Plugin For Intellij

Posted : admin On 1/26/2022

Language support

As listed in the CLion FAQ page, there is currently no official standalone plugin for C/C editing available for IntelliJ IDEA. Just as with some other products such as Jetbrains AppCode, Jetbrains are currently keeping CLion as an exclusively paid product, without a free. To install the plugin, open Settings (either Welcome Configure Settings or File Settings), select Plugins, and press the Browse repositories button. Locate and install the Bazel plugin. You will be prompted to restart CLion. To use Drake in CLion you must use Drake’s bazel wrapper.

  • Java


  • Import BUILD files into the IDE.
  • Compile your project and get navigatable compile errors in the IDE.
  • Run lint from within the IDE with navigatable issues.
  • Support for bazel run configurations for certain rule classes.
  • Run tests from within the IDE by right-clicking on methods/classes.
  • BUILD file language support.

Getting Started


Installing the plugin

  • Install it from within the IDE (Settings > Plugins > Install >Browse Repositories, and search for ‘Bazel’).
  • Download from the JetBrains plugin repository.
  • Build directly from source.

Our plugins are compatible with IntelliJ 2017.3.3 and later. When new majorversions of the IDE are released, it usually takes a few months before werelease a compatible version of the plugin. Full compatibility details arelisted on the JetBrains plugin repository.

See Importing a Project on how to import your first bazelproject.


Syncing your project

Whenever you change a BUILD file your IDE project structure may becomeout-of-date. To fix this, you need to sync your project with your BUILDfiles.

Sync Project with BUILD Files


When you press this, your entire project is synced. This menu optioncorresponds to the bazel button in the toolbar. If you don’t want to learnanything else, this can be your go-to sync action.

Expand Sync to Working Set

Your working set is any files your VCS says is dirty, roughly correspondingto something like git status. By default we try to expand the syncto cover any target in your working set. This ensures these files are refreshedwithout having to go to the trouble of adding a temporary targetto your project view.

If it causes problems you can turn this off in the Bazel menu.

Non-Incrementally Sync Project with BUILD Files

Recomputes certain things that are otherwise cached.You should never have to use this, but exists for debugging/fallbackpurposes.

Sync Working Set

Your working set is any files your VCS says is dirty, roughly correspondingto something like git status. This action tries to sync only your workingset, cutting down on sync time. This is useful if you want to quicklybring in new dependencies in some files you are working on.

Partially Sync File with Bazel

Syncs only the targets corresponding to the file from which this actionis invoked. Can cut down on the time to sync the project if you’re onlyinterested in resolving a single file.

Automatic Sync

You can enable automatic syncing in Settings > Other Settings > Bazel.This automatically runs a sync whenever BUILD files change. For manyprojects this is too slow, so this is off by default.

Building your project

  • Bazel > Make Project builds all targets in the project using Bazel.
  • Bazel > Compile File builds the bazel target associated with the opensource file.

Arduino IDE times

Recently i've started to play with Arduino and also different other micro controllers like

Clion Plugin For Intellij Idea

Originally i've used Arduino IDE to develop and upload sketches to the MCU.
But as a java/javascript software developer i always felt myself unhappy since i could not use my favourite IntelliJ IDEA for this. There is a CLion Arduino plugin present in IntelliJ plugins repository i've tried it but still was unhappy (also i used trial version of CLion since it does not have community version).

Clion Bazel Plugin

But recently i've found such a great project - PlatformIO created by Ivan Kravets from Ukraine which is very great since i'm also from Ukraine.

PlatformIO to the rescue

In short PlatformIO is free and open-source cross-platform code builder and library manager for Arduino with Continuos and IDE integration. It has pre-configured settings for the most Arduino Boards.
The great thing is that it supports not only Arduino but other MCU's as well - you could see list of supported platforms here. Also it does not require installed Arduino IDE - it is completely independent solution: toolchain for specific platform is downloaded and managed by Platformio.
So how to use PlatformIO and how to integrate it with IntelliJ IDEA?
using PlatformIO within IntelliJ IDEA

Installing PlatformIO

First of all we have to install PlarformIO. It uses python and supports most OS which includes Windows, Linux and OSX. I will describe installation under OSX since i'm using this OS, but you could read the official get started section to see how to install it under other platforms. All installation steps should be performed from command line.
So first of all check whether you have installed python package manager pip:
if pip is not installed you could install it by running the following command:

after this lets install PlatformIO by itself:

Creating new project with PlatformIO

Now lets create first project with platformio. Create folder where your test project will be placed, cd to this folder. Then run:
Here i've created project for the Adruino UNO board. If you wish to use other board - you could find it's name using the following command:
And then just find in the command output name of your board (for Arduino boards see atmelavr platforms section). An example output of this command is the following:
Name from type column is what you need to specify in --board parameter.
After initialising your project structure will be the following:
.gitignore - handy if you going to store your project in git cvs.
.travis.yml - for CI integration
lib - place here your libraries
platformio.ini - main configutation file. For now its ok to use defaults here.
src - your sketch should be placed here.

Compiling and uploading sample blink sketch with PlarformIO

lets create sample blink sketch:
  • create file blink.ino in src folder
  • copy blink example into this file:

Intellij Idea Plugins

now we can compile the code by running the following command in the root folder of our sample blink project:
The sample output looks like:
Great! Compilation was sucessful!
Lets upload this sketch to the Arduino UNO board. Attach arduino board to your mac or pc and run the following command:
platformio will try to recognize usb port to which arduino is attached and will upload your sketch to the board.
Thats it!

IntelliJ IDEA (and CLion as well as other IntelliJ products) integration

So starting from now you do not need Arduino IDE - you could compile and upload your sketches directly via command line!

Intellij Add Plugin

But wait... what about IntelliJ IDEA integration?
Well integration of PlatformIO with IDEA is far from excellent - unfortunately there is no IDEA plugin for PlatfomIO yet, so let's see what we could do.

Creating IDEA project from PlatformIO project

Choose File->New->Project from Existing Sources...

Then choose root folder of your PlatformIO project:

Then choose 'Create project from existing sources'

Then just click next:

Now you could see our project opened:

You could use great IDEA terminal plugin to run PlatformIO commands right from IDEA:

And that's all?
Well there is one more thing we could do - we could use IDEA Ant integration to be able to run basic commands like compile and upload using IDEA build configuration.

Using Ant build file for IDEA build config support

Lets create build.xml file in the project root, and place the following text inside it:

After this we could add these ant targets to build config.
First open Ant plugin toolbar:

Then click on + sign and select build.xml file from the project root:

After this in Ant toolbar you will see available ant commands. You could run them right from the Ant build toolbar window:

Or you could create new build config.
To do this click 'Edit Configurations...' in the main toolbar:

Click + sign to add new configuration and choose 'Ant Target':

Click on a ... button right below build config name - you will see all available ant targets. Choose one you want to execute, for example 'upload':
Then click 'Ok':
After this you will see new Ant build config in the toolbar:

So you could run it. First time you probably get error message that you have no configured JDK for the project. Despite the fact that you do not need JDK, you have to setup it in order to satisfy IDE requirements. Press Cmd+; and choose JDK:

Then click Ok.
After this you could run your PlatformIO commands right from IDE. You could see command output in the 'Messages' panel:

That's it!Clion Plugin For Intellij
Not so much integration as you would probably expect, but for me it's much more better than using native Arduino IDE.
Thanks a lot for reading this long post to the end!
See you later!