Cannot resolve language with id ''JVM'' and "Kotlin"

Answered

Hello, 

I was trying to create a plugin that adds line markers to both Java and Kotlin PSI elements. I followed the documentation and tried to solve the problem. Still can't figure out why this problem is happening. I am a student and a beginner for this problem. Please help for understanding why this problem occurs and how to solve it.

Unresolved code is marked below <<not solved>>

My plugin.xml is:

<idea-plugin>
<id>example.de.LineMarker</id>
<name>Line Marker for Trial</name>
<vendor email="support@example.de" url="http://www.example.de">Example Company</vendor>
<description><![CDATA[
line marker to trial part..........<br>
]]></description>
<!-- please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products-->
<depends>com.intellij.modules.platform</depends>
<depends>org.jetbrains.android</depends> <<not solved>>
<depends>org.jetbrains.kotlin</depends>
<extensions defaultExtensionNs="com.intellij">
<codeInsight.lineMarkerProvider language="JVM" <<not solved>>
implementationClass="de.example.LineMarker.RandomLineMarker"/>
<codeInsight.lineMarkerProvider language="Kotlin" <<not solved>>
implementationClass="de.example.LineMarker.RandomLineMarker"/>
</extensions>
<actions>
<!-- Add your actions here -->
<action id="ExecuteLineAnalysis"
class="de.example.LineMarker.RunLineMarkerAction"
text="Run Line Marker" description="Check for Line Marker">
<add-to-group group-id="AnalyzeMenu" anchor="last"/> <<not solved>>
</action>
</actions>
</idea-plugin>



My build.gradle is following: 

plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.4.21'
id 'maven'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
}
apply plugin: 'idea'
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'
apply plugin: "kotlin"

group 'de.example'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72")
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.swinglabs.swingx', name: 'swingx-all', version: '1.6.4'
compile "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
}
intellij {
plugins 'android', 'java', 'maven', 'gradle'
plugins 'Kotlin'
//version '2019.2.2'
updateSinceUntilBuild false
}
runIde {
jvmArgs '-Xmx4G'
jvmArgs '-Xss100m'
}
patchPluginXml {
sinceBuild '191'
untilBuild '202.*'
changeNotes """
Add change notes here.<br>
<em>most HTML tags may be used</em>"""
}
0
4 comments

In your Gradle configuration, you have set plugins twice overriding the list just with Kotlin. Merge it into one list of plugins instead:

intellij {
plugins 'android', 'java', 'maven', 'gradle', 'Kotlin'
}

 

1
Avatar
Permanently deleted user

Thank you. All the other lines resolved except Kotlin language. Now, only this is not resolved yet. What should I do?

<codeInsight.lineMarkerProvider language="Kotlin" <<not solved>>
implementationClass="de.example.LineMarker.RandomLineMarker"/>
0

Kotlin language should be written lowercase:

language="kotlin"
0
Avatar
Permanently deleted user

Sorry. that was a typing mistake. But 'kotlin' language is not resolved yet.

<codeInsight.lineMarkerProvider language="kotlin" <<not solved>>
implementationClass="de.example.iem.LineMarker.RandomLineMarker"/>

Besides, I still couldn't show the line marker to kotlin files. I don't know what is the issue. Can you please have a look?

package de.example.iem.LineMarker;

import com.intellij.codeHighlighting.Pass;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.LineMarkerProvider;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Set;

public class RandomLineMarker implements LineMarkerProvider {

@Override
public @Nullable LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
if(psiElement instanceof PsiStatement){
return CreateNewMarker(psiElement);
}
else{
return null;
}
}
private LineMarkerInfo CreateNewMarker(PsiElement psiElement){
return new LineMarkerInfo(psiElement, psiElement.getTextRange(), IconLoader.getIcon("/icons/cognicrypt.png"), Pass.LINE_MARKERS,null, null, GutterIconRenderer.Alignment.LEFT);
}
}

 

This is my working repository: https://github.com/Projucti/LineMarker.git

0

Please sign in to leave a comment.