Custom Jetbrains Plugin - Missing Dependency

200 views Asked by At

I'm trying to build my own custom line marker for Clion following this tutorial - https://plugins.jetbrains.com/docs/intellij/line-marker-provider.html . My question is about the language attribute on the extension tag in the plugin.xml file ...

<extensions defaultExtensionNs="com.intellij">
  <codeInsight.lineMarkerProvider language="JAVA"
          implementationClass="org.intellij.sdk.language.SimpleLineMarkerProvider"/>
</extensions>

When i add this extension the language="JAVA" gets highlighted in red. What plugin/dependency do i need to add for this to be resolved?

My IDE is also not able to resolve PsiIdentifier and PsiMethod from the provided snippet ...

public class MyCorrectLineMarkerProvider implements LineMarkerProvider {
  public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
    if (element instanceof PsiIdentifier && element.getParent() instanceof PsiMethod) return new LineMarkerInfo(element, ...);
    return null;
  }
}

This is what my build.gradle looks like, i know there are some other dependencies i need to add but the tutorial i've been following isn't very clear about it.

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

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

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
    version = '2021.2.2'
}

runIde {
    jvmArgs '--add-exports', 'java.base/jdk.internal.vm=ALL-UNNAMED'
}

patchPluginXml {
    changeNotes = """
      Add change notes here.<br>
      <em>most HTML tags may be used</em>"""
}
test {
    useJUnitPlatform()
}
1

There are 1 answers

0
Abby On

You have to add a dependency on the java plugin in your build.gradle, like so

intellij {
    plugins = ['java']
}

See the IntelliJ Dev Guide for more information on plugin dependencies.

The tutorial you are following is meant for adding support for a new language, instead you are adding a line marker to Java (existing language :p). Plugin dependencies are simply outside the scope of that tutorial.