# Develop plugins for CLion

> **TL;DR**
> Language: Java or Java-based (refer to [Kotlin for Plugin Developers](https://plugins.jetbrains.com/docs/intellij/using-kotlin.html))
>
>
>
> IDE:      IntelliJ IDEA Community / Ultimate
>
>
>
> Workflow: Gradle-based - recommended for new plugins, DevKit - supported for existing plugins
>
>
>
> Available API: IntelliJ Platform API

When you miss certain functionality in CLion, you may consider writing your own plugin. This article is intended to help you grasp the basics of the IntelliJ Platform plugin development and guide you through the very first steps of implementing your CLion plugin.

Any CLion plugin is an extension to the [IntelliJ Platform](https://www.jetbrains.com/opensource/idea/), so in general it is a specific Java project. There are two supported workflows for IntelliJ plugin development: either using [gradle-intellij-plugin](https://github.com/JetBrains/gradle-intellij-plugin) with [Gradle](gradle-support.html) as a build system (the recommended way) or [DevKit](https://plugins.jetbrains.com/docs/intellij/developing-themes.html) with the IntelliJ IDEA’s own build system.

> **Tip:**
> For more information, refer to [Plugin development Quick Start Guide](https://plugins.jetbrains.com/docs/intellij/plugins-quick-start.html) in the Platform SDK documentation.

As an IDE for your plugin development, use IntelliJ IDEA [Community or Ultimate](https://www.jetbrains.com/idea/features/editions_comparison_matrix.html) edition.

Apart from the IntelliJ IDEA itself, you will need a target CLion distribution. With the Gradle-based approach, it can be downloaded automatically by the build script. In case of using DevKit, make sure to install CLion manually.

## Platform Open API

CLion doesn’t provide its own public API with the guaranteed stability and detailed descriptions, yet you can use all the features of the [Platform Open API](https://plugins.jetbrains.com/docs/intellij/explore-api.html). An effective way to explore the Platform API is to obtain and inspect the sources of the IntelliJ IDEA Community Edition from the official [repository](https://github.com/jetbrains/intellij-community).

The API of the IntelliJ Platform can change between releases and therefore affect plugins functionality. Such changes are listed in [Incompatible Changes in IntelliJ Platform and Plugins](https://plugins.jetbrains.com/docs/intellij/api-changes-list.html). Note that CLion internal SDK might change at any point without prior notice.

For assistance with the API usage for your CLion plugin, feel free to ask on the [community forum](https://intellij-support.jetbrains.com/hc/en-us/community/topics/200366979-IntelliJ-IDEA-Open-API-and-Plugin-Development).

### Extensions

IntelliJ Platform provides [extensions and extension points](https://plugins.jetbrains.com/docs/intellij/plugin-extensions.html) for the plugins to add new or customize the existing functionality. A plugin should declare that it implements one or several extensions `<extenstions>` or extension points `<extensionPoints>` in the `plugin.xml` file. To get the list of the available extensions and extension points, explore the *Extention/*ExtentionPoints files in [this](https://github.com/JetBrains/intellij-community/tree/master/platform/platform-resources/src/META-INF) directory of the Community Edition sources.

Some of the common extension points are the following:

* [Actions](https://plugins.jetbrains.com/docs/intellij/action-system.html) - menu and toolbar items.

* [Code inspections](https://plugins.jetbrains.com/docs/intellij/code-inspections.html) - static code analysis.

* [Intentions](https://plugins.jetbrains.com/docs/intellij/code-intentions.html) - context-specific actions available in the editor.

* [Code completion](https://plugins.jetbrains.com/docs/intellij/code-completion.html).

### Plugin dependencies

Your plugin may depend on classes from other plugins. In this case, plugins can be either bundled, third-party or even your own. For more information about expressing the dependencies, refer to [Plugin Dependencies](https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html).

Your plugin should specify which product or products it will be compatible with (all IntelliJ-based IDEs, CLion only, or some subset). You can do that by declaring module dependencies with the `<depends>` tag in `plugin.xml` (refer to [Plugin Compatibility with IntelliJ Products](https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html)).

Some modules are available in all IntelliJ-based products, while the following modules are available specifically in CLion:

* `com.intellij.modules.cidr.lang` - C/C++ language support (this module is also available in [Android Studio](https://developer.android.com/studio));

* `com.intellij.modules.cidr.debugger` - native debuggers support (also in Android Studio);

* `com.intellij.modules.clion` - core CLion functionality.

## Plugin.xml file

The `plugin.xml` file is a [key plugin descriptor](https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html) that contains the plugin metadata: name, description, author, changelog, and the list of the implemented features.

The values of name, id, description, and vendor are required to get your plugin registered correctly in the plugin database. Every depends parameter, as mentioned above, is an ID of a module the plugin depends on; the list of the depends parameters implicitly defines the compatible products.

> **Tip:**
> You can find examples of the `plugin.xml` files in the [IntelliJ SDK Docs Code Samples](https://github.com/JetBrains/intellij-sdk-code-samples) repository.

## Getting started with a CLion plugin

> **Tip:**
> Take a look at the sources of some ‘CLion-only’ plugins: [Compiler Explorer](https://github.com/ogrebenyuk/compilerexplorer), [Conan plugin](https://github.com/conan-io/conan-clion-plugin), [CMake QuickDocs](https://github.com/EddieRingle/clion-cmakedocs).

Further on, we’ll focus on the Gradle-based approach as the recommended one for all new plugin projects. The DevKit workflow, which is still supported for existing plugins, is described in [Using DevKIt](https://plugins.jetbrains.com/docs/intellij/developing-themes.html).

First of all, [install](https://www.jetbrains.com/help/idea/install-and-set-up-product.html) IntelliJ IDEA Community or Ultimate. And before you start, check that two bundled plugins, Gradle and DevKit, are both enabled in your IntelliJ IDEA instance (go to `Settings | Plugins | Installed` and search for the plugins by name).

Procedure: Gradle-based workflow

Let’s take an example of a plugin that adds Greetings to the IDE main menu and customize it for CLion.

1. Create a new Gradle project with the IntelliJ Platform Plugin selected in the list of Additional Libraries and Frameworks:

![new gradle project for clion plugin](https://resources.jetbrains.com/help/img/idea/2026.2/cl_plugindev_newprj.png)

2. Follow through the process of creating a [new Gradle project](https://www.jetbrains.com/help/idea/gradle.html#project_create_gradle). It’s recommended to select the Use default gradle wrapper option - that way, IntelliJ IDEA will automatically configure everything you need to run Gradle tasks:

![gradle wrapper for clion plugin](https://resources.jetbrains.com/help/img/idea/2026.2/cl_plugindev_gradlewrapper.png)

3. When the template plugin project is ready, invoke the Gradle tool window from `View | Tool Windows | Gradle` and notice the runIde task. This task launches the plugin’s target IDE (by default, it’s configured to be IntelliJ IDEA):

![template plugin project](https://resources.jetbrains.com/help/img/idea/2026.2/cl_plugindev_template.png)

See the full [list](https://github.com/JetBrains/gradle-intellij-plugin/blob/master/README.md#tasks) of the tasks provided by the gradle-intellij-plugin.

4. Now let’s modify the default project:

* Add a new Java class called HelloAction: ```JAVA import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; public class HelloAction extends AnAction { public HelloAction() { super("Hello"); } public void actionPerformed(AnActionEvent event) { Project project = event.getProject(); Messages.showMessageDialog(project, "Hello world!", "Greeting", Messages.getInformationIcon()); } } ```

* Place the following dummy code into `plugin.xml`: ```XML <idea-plugin> <id>org.helloplugin</id> <name>Hello Action Project</name> <version>0.0.1</version> <vendor email="dummy" url="dummy">dummy</vendor> <depends>com.intellij.modules.lang</depends> <extensions defaultExtensionNs="com.intellij"> </extensions> <actions> <group id="MyPlugin.SampleMenu" text="Greeting" description="Greeting menu"> <add-to-group group-id="MainMenu" anchor="last"/> <action id="Myplugin.Textboxes" class="HelloAction" text="Hello" description="Says hello"/> </group> </actions> </idea-plugin> ```

* Change the `intellij` entry in the `build.gradle` script (for more information, refer to [Setup DSL](https://github.com/JetBrains/gradle-intellij-plugin/blob/master/README.md#setup-dsl)): ```CONSOLE intellij { version 'LATEST-EAP-SNAPSHOT' type 'CL' } ``` CLion was published to the Maven-compatible [artifacts repository](https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html) along with the 2019.2 EAP. So currently, you can use either `LATEST-EAP-SNAPSHOT` or `191-EAP-SNAPSHOT` as a version specifier.

5. Now we can run the runIde task and see Greetings in the CLion main menu:

![new menu item as a plugin](https://resources.jetbrains.com/help/img/idea/2026.2/cl_plugindev_sampleresult.png)

## Further steps

The above example is very basic, it employs only the common IntelliJ functionality without CLion specifics. To dig deeper, explore the [Plugin Structure](https://plugins.jetbrains.com/docs/intellij/plugin-structure.html) section and [CLion Plugin Development](https://plugins.jetbrains.com/docs/intellij/clion.html) in the SDK documentation, [IntelliJ SDK docs FAQs](https://github.com/halirutan/intellij-sdk-docs/wiki/FAQ) and the [community forum](https://intellij-support.jetbrains.com/hc/en-us/community/topics/200366979-IntelliJ-IDEA-Open-API-and-Plugin-Development).

If you are interested in developing a plugin for custom language support, refer to the [dedicated section](https://plugins.jetbrains.com/docs/intellij/custom-language-support.html) in the Platform SDK documentation, and take a look at [Antlr's plugin development notes](https://github.com/antlr/antlr4-intellij-adaptor/blob/master/doc/plugin-dev-notes.md).

The [PSI Viewer](https://plugins.jetbrains.com/plugin/227-psiviewer) plugin can help you get familiar with the Program Structure Interface, [PSI](https://plugins.jetbrains.com/docs/intellij/basics/architectural_overview/psi.html).

See also the guidance docs on [testing](https://plugins.jetbrains.com/docs/intellij/testing-plugins.html) your plugin. The topic of publishing a plugin is discussed in [Publishing plugins with Gradle](https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html) and [Publishing DSL](https://github.com/JetBrains/gradle-intellij-plugin/blob/master/README.md#publishing-dsl).

## See also

### External Links

[CLion Plugin Development (Platform SDK documentation)](https://jetbrains.org/intellij/sdk/docs/products/clion.html) [IntelliJ SDK docs FAQs](https://github.com/halirutan/intellij-sdk-docs/wiki/FAQ) [Community forum](https://intellij-support.jetbrains.com/hc/en-us/community/topics/200366979-IntelliJ-IDEA-Open-API-and-Plugin-Development)

