Using IntelliJ 2019.3.1 for plugin development for Clion. How to add c++ language support for my plugin project?

I am currently learning about writing plugins for IntelliJ IDEs. I am especially interested in developing plugins for CLion. Therefore I would like to add support for c++ to my plugin project.

My problem:
I read in the documentation how to develop plugins for c++.However the way it is described does not work for me. IntelliJ cannot resolve the dependency I want to add.

What I currently know:
1. This part of the documentation explains that plugins may depend on other plugins, and how to add dependencies.

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 instructions on how to express the dependencies, refer to Plugin Dependencies.

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 tag in plugin.xml (see Plugin Compatibility with IntelliJ Products).

2. This part of the documentation explains which functionality is in which plugin. Each specific language seems to be a plugin. So developing a plugin which wants to parse c++, will depend on the c++ plugin.

Modules Specific to Functionality More specialized functionality is also delivered via modules and plugins in IntelliJ Platform-based products. For example, the com.intellij.modules.python module supports the Python language-specific functionality. If a plugin uses functionality from this module, such as Python-specific inspections and refactoring, it must declare a dependency on this module.

...

The following table lists(1) modules or built-in plugins that provide specific functionality, and the products that currently ship with them.

According to the table mentioned above I need to add <depends>com.intellij.modules.cidr.lang</depends> as dependency for c++. However when I add this line to my plugins.xml file the cidr.lang part is not recognized. imessageapp

3. In this Stackoverflow question, which is about java plugin development, someone answered that there was recently a change, that one now also has to add the needed plugins to build.gradle. Furthermore there was a change tha java language support is now a buildin plugin.

My guess what todo
I guess c++ support is now also a buildin plugin? But how can I add it?

So instead of

intellij {
    version '2019.2'
    plugins 'java'
}

Maybe I need something like this?

intellij {
    version '2019.2'
    plugins 'c++' // or maybe cidr??
}

Appendix
My java class:

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.ui.Messages;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiRecursiveElementWalkingVisitor;
//import com.jetbrains.cidr.lang.psi.OCFunctionDefinition; <-- This import does not work 
public class HelloAction extends AnAction {
    public HelloAction() {
        super("Hello");
    }

    @Override
    public void actionPerformed(AnActionEvent anActionEvent) {
        Editor editor = anActionEvent.getData(CommonDataKeys.EDITOR);
        PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);
        if (editor == null || psiFile == null) return;
        int offset = editor.getCaretModel().getOffset();

        final StringBuilder infoBuilder = new StringBuilder();
        PsiElement element = psiFile.findElementAt(offset);
        infoBuilder.append("Element at caret: ").append(element).append("\n");
        Messages.showMessageDialog(anActionEvent.getProject(), infoBuilder.toString(), "PSI Info", null);

        psiFile.accept(new PsiRecursiveElementWalkingVisitor(){
            @Override
            public void visitElement(PsiElement element) {
                super.visitElement(element);
                infoBuilder.append(element.getText()).append("\n");

            }
        });
    }

    @Override
    public void update(AnActionEvent e) {
        Editor editor = e.getData(CommonDataKeys.EDITOR);
        PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
        e.getPresentation().setEnabled(editor != null && psiFile != null);
    }
}

My build.gradle file

plugins {
    id 'java'
    id 'org.jetbrains.intellij' version '0.4.15'
}

group 'org.example'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
    version 'LATEST-EAP-SNAPSHOT'
    type 'CL'
}
patchPluginXml {
    changeNotes """
      Add change notes here.<br>
      <em>most HTML tags may be used</em>"""
}

My plugin.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>
    <depends>com.intellij.modules.cidr.lang</depends> // cannot be resolved

    <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>

Please sign in to leave a comment.