Adding Multiple Language support to plugin

Answered

Hello, im currently developing a plugin that is actively using PSI's of different languages. I managed to get some languages working but got stuck at c/c++/obj-c. 
what i did before is add
<depends optional="true" config-file="kotlin-psi.xml">org.jetbrains.kotlin</depends>
<depends optional="true" config-file="golang-psi.xml">org.jetbrains.plugins.go</depends>
<depends optional="true" config-file="java-psi.xml">com.intellij.java</depends>
<depends optional="true" config-file="javascript-psi.xml">JavaScript</depends>
to my plugin.xml
and
intellij {
***
        listOf(
            "JavaScript",
            "org.jetbrains.plugins.go:223.7571.182",
            "com.intellij.java",
            "org.jetbrains.kotlin",
            "Kotlin",
        ),
    )
}
to build.gradle.kts

Now i am able to use code like PsiTreeUtil.getParentOfType(element, JSFunction::class.java)
In documentation i find that <depends> com.intellij.cidr.lang </depends> needs to be added to plugin.xml to work with c/c++/obj-c but what do i add to build.gradle.kts?
 

and while im at it, i dont really get if what im doing with supporting golang is correct. Is there a way to remove the version? or can it be problematic in the future?

Sorry if its silly question, my first jvm project
 

0
3 comments

1)
  "org.jetbrains.kotlin",
            "Kotlin",

is duplicated, remove “Kotlin” here

2) C++ language is only available when targeting CLion. One solution is to have a separate Gradle project/module in your project targeting CLion and the main plugin module then including this module.

3) The same construction could be used for Go. You need to specify a dedicated version for non-bundled plugins, always.

0

Thank you for the reply, are there any examples of how to do it? I've read the documentation but I only found how to make individual CLion extension. 

I think I prefer to have separate module rather than project, this way in the end will there be one extension or multiiple?

0

Sorry for long delay. One plugin using separate modules for each dependent plugin is for example https://github.com/intellij-rust/intellij-rust

0

Please sign in to leave a comment.